in reply to Trouble with loops
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 } }
|
|---|