Since perl 5.13.2 s/// and tr/// support the /r flag, which returns a copy instead of the number of substitutions. The /r feature is called Non-destructive substitution
$ perl -MData::Dump -e " @f = 1..4; dd [ map { s/^/F/r; } @f ]; dd\@f; + " ["F1" .. "F4"] [1 .. 4]
In reply to Re^2: Localize $_ in grep
by Anonymous Monk
in thread Localize $_ in grep
by InfiniteSilence
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |