There's more than one way to do things | |
PerlMonks |
Re: map confusionby Cristoforo (Curate) |
on Dec 16, 2015 at 00:12 UTC ( [id://1150431]=note: print w/replies, xml ) | Need Help?? |
As GrandFather said, $_ gets passed to @incremented before its incremented.
From the docs for map: Note that $_ is an alias to the list value, so it can be used to modify the elements of the LIST. That explains why the original elements in @array change. $_++ modifies the element $_ and $_ * 2 doesn't modify $_.
In Section
Seekers of Perl Wisdom
|
|