in reply to Re: Applying regex to array
in thread Applying regex to array
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
|
|---|