Your use of shift(@array) removes the first element of the array, not the element you are currently examining.for my $i (0..$#array) { if ($array[$i] eq "joby") { splice(@array, $i, 1); last; # exit loop - only interested in the first match } }
In reply to Re: Trouble with loops
by pc88mxer
in thread Trouble with loops
by jobybett
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |