On Sep 11, 2007, at 2:05 AM, Summercool wrote: > On Sep 10, 4:34 pm, Philip Hallstrom <r... / philip.pjkh.com> wrote: > >> foo = foo.to_i + 1 >> >> would work as nil.to_i == 0 > > I think it was also in Perl that $foo++ will work if $foo is not > defined, then it will be just treated as 0. > but if "use strict" then it won't work... It works with strictness on as well. You need to declare the variable, that's the bit strict.pm adds here: $ perl -Mstrict -wle 'my $foo; ++$foo; print $foo' 1 See, $foo is undef when it is incremented. -- fxn