You can shorten it to $total += $increment if you are sure increment is a number.
$total += $increment || 0 will avoid warning if $increment is undefined, but your original version reads better (at least to my eyes).
In reply to Re: Idiomatic Perl
by ysth
in thread Idiomatic Perl
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |