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


in reply to Basic list manipulation, and a bit of map() confusion...

I'm not sure if you're aware of it, but your code modifies @a since $_ in map and for aliases the current list element. If you don't want this, you'd have to localize $_ or to copy the current element to a new lexical variable.