Perl's lack of 'in' keyword
jonathan.stowe at gmail.com
Thu Oct 9 12:40:36 BST 2008
2008/10/9 Iain Barnett <iainspeed at gmail.com>:
> On 9 Oct 2008, at 11:51 am, Andy Armstrong wrote:
>> On 9 Oct 2008, at 01:39, Iain Barnett wrote:
>>> if $a ~~ $b #this could mean several things
>> A smart match between two scalars. Clear.
>>> if $a in $b #it is clear what this means
>> One scalar is in another? WTF?
> What does smart match do if you pass it an array/hash/object ref? If it
> matches against the scalar part then it's not a very smart match, IMO.
Right, it was however unclear from your example what the contents of
the two variables were.
It will of course dereference a hash or array ref if appropriate. I'm
not quite sure what you are proposing it should do when presented with
a blessed reference.
More information about the london.pm