http://www.perlmonks.org?node_id=586118


in reply to modify list through grep

the "aliases" are relevant when you work on a list returned by grep and not on an array that was created using this list.
(unless, of course the original array contained references which will still refer to the same vars/arrays/hashes)

example (here map works on the list returned by grep before it's assigned to an array):

@l = ( "a", "b", "c" ); @m = map {s/a/z/} grep /a/, @l; print @l;
will print "zbc"

Enjoy,
-- Mickey