in reply to Re: how could I use map here?
in thread how could I use map here?
and@my_array_2 = map { local $_ = $_; s/^CHOP_ME_OFF_//; $_ } @my_array;
I've used the latter version often and it seemed to work perfectly fine...@my_array_2 = map {s/^CHOP_ME_OFF_//; $_ } @my_array;
pike
Update:OK, to be honest what I really used was
i. e. I did the replacements in-place, which explains why I never noticed the effect pointed out by adrianh++.@my_array = map {s/^CHOP_ME_OFF_//; $_ } @my_array;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Why localize $_ in the map block?
by adrianh (Chancellor) on Feb 07, 2003 at 13:59 UTC | |
by pike (Monk) on Feb 10, 2003 at 16:30 UTC | |
|
Re: Why localize $_ in the map block?
by bronto (Priest) on Feb 07, 2003 at 14:26 UTC |