flies has asked for the wisdom of the Perl Monks concerning the following question:
I can use grep for this, but still. v5.10.0 built for x86_64-linux-thread-multimy @ar = (0..10); my @ar2 = @ar[1..4]; for my $i (@ar) { # matches for $i==4 only print "$i ~~ slice? ", isTrue($i ~~ @ar[1..4]) # matches properly print "\t$i ~~ ar2? ", isTrue($i ~~ @ar2), "\n"; } sub isTrue { return ($_[0])?"true":"false"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: bug? why does this ~~ smart match to an array slice fail?
by ikegami (Patriarch) on Sep 30, 2010 at 19:02 UTC | |
by flies (Novice) on Sep 30, 2010 at 19:26 UTC | |
by andal (Hermit) on Oct 01, 2010 at 10:05 UTC | |
by ikegami (Patriarch) on Oct 01, 2010 at 16:29 UTC | |
|
Re: bug? why does this ~~ smart match to an array slice fail?
by youlose (Scribe) on Oct 01, 2010 at 13:03 UTC |