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


in reply to RE: Map: The Basics
in thread Map: The Basics

my @array = <FILE>; map s/\#.*$//, @array;
This way of doing things is deliberate, as it eliminates unnecessary assignments when you want the results to go back to the same array.

Except that he explicitly said that if you aren't using the list returned, you shouldn't use map, you should look into another looping structure, such as:

my @array = <FILE>; s/\#.*$// foreach @array;
To do otherwise obfuscates the purpose of your loop.