Why not start with $x = 0, and then pre-increment instead of post-incrementing $x? In other words, ++$x, instead of $x++.
Indeed. In fact it's also worth reminding incidentally that {pre,post}-{increment,decrement} behave intelligently by first of all not complaining under warnings and, in the case of post-ones, to "coerce to numeric value", that is, to return 0:
errol:~ [19:01:32]$ perl -wMstrict -le 'my $x; print map $x++, (1) x 3 +' 012
In reply to Re^3: Word frequency in an array
by blazar
in thread Word frequency in an array
by monkeybus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |