< prev | home | next > 5 of 7

To see why Perl gave 43, I tried writing a subroutine to look at the pieces of the expression.
   # Print values and addresses of passed argument and $m.
   sub look {
     print "look was passed '" . $_[0] . "' at . \$_[0] . ".\n";
     print "while \$m is '" . $m . "' at " . \$m . ".\n";
     return $_[0];
   }

   my $m = 20;
   my $p = look(++$m) + look($m++);
   print $p;

But that's where the quantum weirdness popped up : this gives 42, not 43.
So "looking" at the intermediate results has changed the outcome.