Whilst looping through an array, how do I remove the current
entry?
my @array = qw (one two two three four);
foreach (@array) {
if (/two/) {
print "$_\n";
shift @array;
}
}
print "@array\n";
I'm trying to remove both of the "two" entries from the array so
that the printed output becomes ...
two
two
one three four
I know I can do it by pushing the wanted items into a new array
but the real array is rather large and I'd rather not do that
merely to remove two small entries if at all possible.
--
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs