prev simply isn't Perl. next and last are though.
You can always rewrite a for-loop from:
toforeach my $item (@list) { something($item); }
By modifying $i you can get to the "previous" iteration (something like $i--. However, be careful not to create an infinite loop.for (my $i = 0; $i < @list; $i++) { something($list[$i]); }
Hope this helps, -gjb-
In reply to Re: 'prev' in for loop
by gjb
in thread 'prev' in for loop
by kulls
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |