in reply to Perl disproves commutativity of Addition/Multiplication
All that is happening is that the postfix + 10 and * 10 are being taken as arguments to be passed to the subroutine.
Kinda like the sub was declared with a ($) prototype:
use warnings; use subs qw(non_commutative); sub non_commutative { print "?@_?\n"; return 17 } $x = 10 * non_commutative; $y = non_commutative * 10; print "$x\n$y\n\n"; $x = 10 + non_commutative; $y = non_commutative + 10; print "$x\n$y\n"; __END__ c:\test>junk19 ?? ?*main::10? 170 17 ?? ?10? 27 17
|
|---|