But sometimes it's more intuitive to use for(;;) when you are processing only, say, every third item in a list.foreach my $thing(@things){ process($thing); }
for(my $i=0;$i < scalar(@things); $i += 3){ process($things[$i]); }
In reply to Re: for vs foreach?
by thunders
in thread for vs foreach?
by Flame
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |