map,
grep and other list operators are intended to transform arrays into other arrays by applying code to the array elements one by one.
For speed,
the elements are referenced via a $_ alias rather than copying them.
As a consequence,
if the code block of the map or grep modify $_ in any way,
then it is actually modifying the source array.
This IS technically allowed,
but those side effects can be quite surprising,
especially when the array being passed is @_ or perhaps values(%ENV)!
Instead authors should restrict in-place array modification to for(@array) { ...
} constructs instead,
or use List::MoreUtils::apply().