liz has asked for the wisdom of the Perl Monks concerning the following question:
Aristotle's answer to Switching on internal UTF-8 flaq on DBI result from database made me find the following phenomenon:
The expected output is:$a = [[0]]; foreach (@$a) { $_++ foreach @$_ } print $a->[0][0],$/; $_++ for map @$_, @{$a}; print $a->[0][0],$/; __END__ 1 1
The strange thing is that the extra list flattening with map() doesn't work. I don't see any reason why it shouldn't. I guess the question is: is this a bug or not?1 2
Liz
Update:
Not a bug, just copying of the list with map(). Thanks to !1, blokhead and holo for the enlightenment.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: $_ and list flattening with map()
by !1 (Hermit) on Dec 14, 2003 at 21:18 UTC | |
Re: $_ and list flattening with map()
by blokhead (Monsignor) on Dec 14, 2003 at 21:23 UTC | |
Re: $_ and list flattening with map()
by holo (Monk) on Dec 14, 2003 at 21:44 UTC | |
Re: $_ and list flattening with map()
by pg (Canon) on Dec 14, 2003 at 22:05 UTC |
Back to
Seekers of Perl Wisdom