Or just go backwards...
for my $i ( reverse 0 .. $#ARGV ) { splice( @ARGV, $i, 1 ) if $ARGV[$i] eq 'hello'; }
In reply to Re^2: How can I delete an element in a foreach cycle?
by jasonk
in thread How can I delete an element in a foreach cycle?
by saintex
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |