NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Are these equal? (Score:2, Interesting)
($elem =~ @array) == (@array =~ $elem)
($key =~ %hash) == (%hash =~ $key)
($value =~ (1..10)) == ((1..10) =~ $value)
($value =~ ('a',
Re:Are these equal? (Score:3, Informative)
Larry
Re:Are these equal? (Score:1)
($paco =~ $yakko) == ($paco =~ $yakko)will allways be true? (or are you saying that just the 4 examples $Bob listed will allways be true)What if $paco and $yakko are both sub refs? there's no garuntee that $yakko.($paco) will ever be equal to $paco.($yakko).
for that matter, what about the list behavior Damian describes...
What happens in this scenerio...if ($sub1 =~ ($sub2, $sub3)) { ... }
is it equivilent to
($sub1.($sub2) || $sub1.($sub3))? Or($sub2.($sub1) || $sub3.($sub1))?Reply to This
Parent
Re:Are these equal? (Score:2)
He's saying the latter. The matching rules are supposed to be "sensible" and "reasonable" (for sufficiently vague values of those two words ;-)
The table in A4 [perl.com] lists the behaviours of =~ under various combinations of arguments.