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


in reply to map grep and sort

Inside the filtering block, the list element being examined is set to the default variable $_
To be more precise, $_ is an alias to the list element.

Map takes each item from the list on the right and passes the return value from its block to the left. It does not transform the items on the list even if it feels like that.
That is not correct. From map:
Note that $_ is an alias to the list value, so it can be used to modify the elements of the LIST. While this is useful and supported, it can cause bizarre results if the elements of LIST are not variables.

Note however that Effective Perl Programming, item 20, cautions against this:

For efficiency, $_ is actually an alias for the current element in the iteration. If you modify $_ within the transform expression of a map, you modify the input data. This is generally considered to be bad style, and -- who knows? -- you may even wind up confusing yourself this way. If you want to modify the contents of a list, use foreach.

BTW, in the same item, "Use foreach, map and grep as appropriate", Effective Perl Programming provides a nice summary of when to use foreach, map and grep: