in reply to Re^11: If you believe in Lists in Scalar Context, Clap your Hands
in thread If you believe in Lists in Scalar Context, Clap your Hands
The assignment operator itself happens to be both in scalar and in list context. It produces both a list for the list, and a scalar for the function scalar(). Which oddly leads to the possibility of saying the assignment operator in this:perl -e 'print scalar( ($x, $y ) = ( 42, 101, 202 ) ); print "\n$x\n$y +\n";'
... is both in scalar and void contexts.perl -E 'say scalar(() = ($a, $b, $c))'
I'm not sure how this is any more clear than saying there are exceptions to a general rule about lists returning something of their own accord.
|
|---|