in reply to Curious find while comparing grep, map, and smart match...
redo if ( @gArray && grep { /$rInt/ } @gArray ); ... redo if ( @mArray && map { /$rInt/ } @mArray ); ... redo if ( @sArray && $rInt ~~ @sArray );
The three are not equivalent. grep and map use regular expressions and have code blocks while the other does not. Try it like this:
redo if @gArray && grep /$rInt/, @gArray; ... redo if @mArray && map /$rInt/, @mArray; ... redo if @sArray && /$rInt/ ~~ @sArray;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Curious find while comparing grep, map, and smart match...
by dbuckhal (Chaplain) on Mar 27, 2013 at 03:17 UTC |
In Section
Seekers of Perl Wisdom