If you need something like the copy - do something more often, you could also create a copy-wrapper for map, let's call it cwmap:
sub cwmap( &@ ) { map { local $_ = $_; # create copy $_[0]->(); # execute code-block $_; # copied element } @_[ 1..$#_ ]; # list } # cwmap # and then use it like map: @new = cwmap { s/$_/$_,hi/ } <TEST>;
Best regards,
perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32"
In reply to Re^2: Using regex in Map function
by strat
in thread Using regex in Map function
by narashima
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |