[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Omaha.pm] evolution
$x = $x + 1;
$x += 1;
$x++;
Those all do the same thing. I ran into the 2nd version today and was
surprised it wasn't the 3rd. :)
They're not all the same.
$ cat foo.pl
$a = 'x'; $a = $a + 1;
$b = 'x'; $b += 1;
$c = 'x'; $c++;
print join ", ", ( $a, $b, $c );
$ perl -l foo.pl
1, 1, y
Didn't know Perl could increment strings, didja? :-)
Lots of things like this are on our new site, perl101.org
xoxo,
Andy
--
Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance