go ahead... be a heretic | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
The line: $_++ for map $_, @a;generates an anonymous list with map, then iterates through it with for incrementing all its values. Once for is done, the list is thrown away (expensive no-op). The line: $_++ for my @b = map $_, @a;generates a list with map and throws it in @b, then iterates through it with for incrementing all values as before. This time, the list is not anonymous and may be accessed by using @b and it's not thrown away. Once map is evaluated, values in @b are totaly independent from values in @a. In reply to Re: $_ and list flattening with map()
by holo
|
|