in reply to Regexp map weirdness
If you change your code to use $_ instead, you will get the results you expected:
I'm not sure how this snippet is being used in a larger script, but map may not be what you want here. One alternative would be to assign to @f directly: @f = (m/t(.*?)e/, m/wri(.*?)en/);open(FH,"</usr/bin/perldoc"); undef $/; $_=<FH>; map (($f[$c]=$_,print "$f[$c]", $c++), m/t(.*?)e/, m/wri(.*?)en/);
|
|---|