A nit (which I'm sure atcroft knows about) for the benefit of OP: it is important to remember from time to time that $_ is actually an alias to each element in the list being processed by a for loop (or map or grep). This is important because if you change $_ inside the loop the current list element's value is altered. Consider:
use strict; use warnings; my @array = qw(1 3 5 6); ++$_ for @array; print "@array";
Prints:
2 4 6 7
Each of the elements in the array @array has been incremented by the for loop.
In reply to Re^2: Having problems with addition in sub
by GrandFather
in thread Having problems with addition in sub
by bluethundr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |