in reply to smart match operator should be smarter!
Ok, thanks. I see that my last problem is the same problem: you can't use the match operator with a literal. So you have to do this:
my @arr1 = (2, 34); my $val = 34; say "34" if $val ~~ @arr1; #34
But the smart match operator is supposed to be commutative, yet:
my @arr1 = (2, 34); my $val = 34; say "34" if @arr1 ~~ $val; #no output...??
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: smart match operator should be smarter!
by ikegami (Patriarch) on Nov 21, 2009 at 19:04 UTC | |
by 7stud (Deacon) on Nov 22, 2009 at 00:01 UTC | |
by ikegami (Patriarch) on Nov 22, 2009 at 00:13 UTC |