You're viewing a comment by DanL and its responses.

DanL Permalink
November 30, 2009, 21:01

It looks like the benefit of the inchworm-on-a-stick method is that it returns the value decremented, without actually decrementing the value:

my $a = 0;my $b = 2;$a = --$b;print "\$a : $a\n";print "\$b : $b\n";#-----$a = 0;$b = 2;$a = ~-$b;print "\$a : $a\n";print "\$b : $b\n";
returns:$a : 1$b : 1$a : 1$b : 2

Reply To This Comment

(why do I need your e-mail?)

(Your twitter name, if you have one. (I'm @pkrumins, btw.))

Type the first letter of your name: (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.