in reply to This is odd.

And put one more way, if I may . . .

The dot operator is used to concatenate string data into a single scalar. Once you've done that, you're trying to use a (+) operator to do arithmetic between a string scalar and an integer, which is not defined. You confuse the poor compiler this way.

-- Hugh

if( $lal && $lol ) { $life++; }

Replies are listed 'Best First'.
Re^2: This is odd.
by JDelmoso (Novice) on May 23, 2008 at 05:22 UTC
    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.
      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.