perldoc -t -f grep
yields (in part)...
Note that, because $_ is a reference into the list
value, it can be used to modify the elements of
the array. While this is useful and supported, it
can cause bizarre results if the LIST is not a
named array. Similarly, grep returns aliases into
the original list, much as a for loop's index
variable aliases the list elements. That is,
modifying an element of a list returned by grep
(for example, in a foreach, map() or another
grep()) actually modifies the element in the
original list. This is usually something to be
avoided when writing clear code.
-- Randal L. Schwartz, Perl hacker