my $i=0; # this variable will be visible in the foreach scope foreach my $name (@names) { next unless $name; ++$i; # autoincrement check_names($name); } say $i;
In reply to Re: Counting in loop help!
by aitap
in thread Counting in loop help!
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |