Hi all,
I was wondering if it was possible to remove an item from a list whilst one
is repeating over it with a foreach statement. For example, I was hoping
that the following code fragment would do this - but instead it does
exactly what I told it to do :) That is it leaves the item there but with
an undefined value.
my @list = qw ( alpha beta omega );
foreach (@list)
{
/b/ && undef($_);
}
foreach (@list)
{
print "$_\n";
}
Any thoughts?
Thanks in advance.
David Kalnins
- RE: Removing an item from a list David_Kalnins
- RE: Removing an item from a list King, Jason
