# This is an attempt at emulating ++$m with preInc($m) sub preInc { $_[0] = $_[0] + 1; # Increment input argument (the side effect), return $_[0]; # and return the new, incremented value. } # And this is an attempt at emulating $m++ with postInc($m) sub postInc { my $temp = shift; # Remember original value, $_[0] = $_[0] + 1; # increment input argument (the side effect), return $temp; # and return the old, un-incremented value. } my $m = 20; print preInc($m) + $postInc($m); # This prints 42. # The final value is $m is 22.