in reply to Re: Confused as to why the "casting context" is mis-behaving
in thread Confused as to why the "casting context" is mis-behaving
Hmm. Please point to documentation. Your description of what's happening jibes with what we see, but I had the same impression as the original poster, i.e. that this was not the way it would work.
If there is no documentation, and I couldn't find any, then there needs to be. I'm not sure where to put it though. I looked in perlop under comma and perldata under slices.
In fact, under perltrap, I found:
Which I would take to be documentation to the contrary.
? Comma operator in scalar context gives scalar context to args
The comma operator in a scalar context is now guaranteed to give
scalar context to its arguments.
$x = (1, 2, @y);
print "x = $x\n";
# Perl4 prints: x = c # Thinks list context interpolates list
# Perl5 prints: x = 3 # Knows scalar uses length of list