in reply to $_ and list flattening with map()
I always thought map just returns copies of the values?
my @a = qw(1 2); my @b = \(@a); my @c = \(map $_,@a); print "Addresses do not match$/" unless "@b" eq "@c"; __END__ Addresses do not match
Of course, changing your map to:
${$_}++ for map \(@$_),@{$a};
Will make it work as expected.
|
|---|