in reply to Solved: map on array reference
G'day natxo,
I see you've marked this as "Solved"; however, I thought I'd point out that, because map aliases $_ to each element of the list, you can do your substitution in-place. E.g.
$ perl -wE 'my $x = [qw{ab ac ad}]; say "@$x"; map { s/a/z/ } @$x; say + "@$x"' ab ac ad zb zc zd
— Ken
|
|---|