Apologies if this has been discussed already.
In the above code to get the iteration number I am using a explicit flag to get the iteration count. I am interested to know, is there any built-in variable available to hold the iteration count ? For example $. holds the line number during the any FILEHANDLING operation.my $iteration_number = 1; foreach my $val ( @array ) { print ":$iteration_number:\n"; $iteration_number ++; }
In reply to getting iteration number inside iteration loop by jesuashok
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |