in reply to Re: This is odd.
in thread This is odd.

Oh, my. Poor compiler. What do the commas do, then? I don't know why I used them, probably picked them up at some point dabbling around in Perl earlier.

Replies are listed 'Best First'.
Re^3: This is odd.
by mr_mischief (Monsignor) on May 23, 2008 at 19:21 UTC
    They make print aware that it's dealing with a list of different items, due to list operator precedence rules.

    According to perlop:

    In the absence of parentheses, the precedence of list operators such as print, sort, or chmod is either very high or very low depending on whether you are looking at the left side or the right side of the operator. For example, in
    @ary = (1, 3, sort 4, 2); print @ary; # prints 1324
    the commas on the right of the sort are evaluated before the sort, but the commas on the left are evaluated after. In other words, list operators tend to gobble up all the arguments that follow them, and then act like a simple TERM with regard to the preceding expression. Note that you have to be careful with parentheses:
    # These evaluate exit before doing the print: print($foo, exit); # Obviously not what you want. print $foo, exit; # Nor is this. # These do the print before evaluating exit: (print $foo), exit; # This is what you want. print($foo), exit; # Or this. print ($foo), exit; # Or even this.