my @x = chomp <DATA>;
Bingo, @x is gets a one-element list -- or at least, it's a list in list context and a scalar in scalar context. Tricky! Here's a mind-bender. What's this?
1, 2, 3
It could be a three-element list, in list context, or it could be a scalar and two void expressions (which get optimized away), in scalar context. In void context, it could be nothing.
Update: Reworded one sentence. | [reply] [d/l] [select] |
So, then, scalar also returns a list in list context? (BTW, @x is an array, not a one element list.)
| [reply] [d/l] |
| [reply] [d/l] |
when used with a list, it returns the total number of characters chomped... and not a list (so, you are right that there is no "list context" to it.
[]s, HTH, Massa (κς,πμ,πλ)
| [reply] |