I don't really understand why you've chosen to use grep here instead of map. With grep you'll lose any elements where the substitution didn't change anything.
my @fields = qw/this is the_other/; @fields = grep { s/t/j/ } @fields; print "@fields"; # prints "jhis jhe_other" (losing "is")
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
In reply to Re^2: Applying regex to array
by davorg
in thread Applying regex to array
by loris
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |