in reply to Re: Localize $_ in grep
in thread Localize $_ in grep

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]