in reply to Re^3: Map function slowing down program
in thread Map function slowing down program
>perl -le"@rxs='(.)(.)'; $line = 'ab'; my $cnt = grep $line =~ $_, @rx +s; print $cnt" 1 >perl -le"@rxs='(.)(.)'; $line = 'ab'; my $cnt = map $line =~ $_, @rxs +; print $cnt" 2
grep is more robust. It'll work with just about any expression, whereas map only works with very specific expressions.
|
|---|