The latter offers more control, but isn't necessary for most looping purposes.foreach (@arr[0..2]) { $_++; } for (my $i = 0; $i <= 2; $i++) { @arr[$i]++; }
In reply to Re: which loop is better
by TedPride
in thread which loop is better
by TheMarty
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |