in reply to Re: changing array size in foreach loop: is it safe?
in thread changing array size in foreach loop: is it safe?

It occurred to me that in my real code I don't actually need the value of @foo afterwards, so I should just use shift:
while (@foo) { my $x = shift @foo; push @foo, 'h' if whatever(); }