in reply to Removing Items from an Array

Use splice to remove elements from an array.

for (0..$#array) { if (foo($array[$_])) { splice @array, $_, 0; # remove it. } else { print "$array[$_] returned false\n"; next; } other_stuff(); }

Actually, don't use that code. Why? Because your loop will soon become out of sync with the array. You can still use splice but you have to keep your index in sync while you iterate and remove elements.

my $i = 0; for my $item (@array) { if (foo($item)) { splice @array, $i, 0; # remove it. } else { print "$item returned false\n"; $i++; next; } other_stuff(); }
-sauoq
"My two cents aren't worth a dime.";