from Programming Perl pg 90, he says:
@ary = (1, 3, sort 4, 2);
print @ary;
the commas on the right of the sort are evaluated before the sort but the commas on the left are evaluated after. ... list operators tend to gobble .. and then act like a simple term"
- Does the assignment result in sort being processed or does that happen when
@aryis expanded by print? - What does he mean by all that "comma" stuff?? My understanding is that in the assignment statement, comma has a lower priority than a list operator therefore sort runs first and gobbles up it's arguments
(4 and 2).. How the heck is comma being evaluated at all?? So that statemnent then becomes (1, 3, 2, 4) a list which is assigned.. comma is just acting as a list separator and not an operator!! In fact on pg:108 he says: do not confuse the scalar context use of comma with list context use.. What is a leftward and rightward list operator?
print @aryis a rightward list operator?? So it has very low priority?print($foo, exit);
here, how is precedence evaluated? print is a list operator that looks like a function so it should run first! it has two arguments $foo and exit.. so why is exit not treated as a string??? After all priority-wise print(the list operator) has higher priority??
print $foo, exit;
here, you have print and , operators but the list operator has higher precedence.. so.. exit should be treated as a string - why not??
print ($foo & 255) + 1, "\n";
here since it's a list operator it prints $foo & 255 Shouldn't something similar happen with the above mentioned exit stuff..