in reply to map confusion

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 $_.

Replies are listed 'Best First'.
Re^2: map confusion
by Anonymous Monk on Dec 16, 2015 at 00:43 UTC

    Thanks Monks. Got it.