in reply to The Comma Operator

I once worked out this convoluted way to access time only once per reading without using a temporary.
perl -lwe'$oldtime = $^T; print( -(($oldtime+0) - ($oldtime = time)) ) while sleep 1'
(Not to be obscure: the normal way to do this is something like:my $tm = time;  print $tm - $oldtm;  $oldtm = $tm; The only complicating factor being that you don't want to call time() twice since it may roll over in between.  In order to avoid using a temporary, the old value of oldtime must be put into the calculation before oldtime is set to its new value which must also be used. A substraction requires that its arguments be ordered, and sub-expressions for both parts seems to work.)

But note well, the docs often note that the order of evaluation of arguments to functions is not defined. (This is a long-time caveat carried over from c.) For instance, the above can easily be broken:( -(($oldtime || $^T) - ($oldtime = time)) ) returns a stream of -0's!

Udpate: And here's a fibonacci series that depends on $b being returned *before* it is updated.
perl -e'$\=$,=$";$b=1; print $b, $a += $b += $a while $a <1000; print"\n"'
Update the second: Note also, that any halfway ambitious optimizer could reduce -( (x + 0) - (x = y) ) to (x = y) - (x) to x - x to 0 and produce:print 0;
  p