in reply to Re^3: self-feeding infinite loop
in thread self-feeding infinite loop
But you're definitely in the territory of "unpredictable behaviour"
I may be being somewhat picky (or I may even be downright wrong), but I don't see any "unpredictable behaviour" there. I agree that one needs to be careful when modifying an array by iterating over the same array, but the following does behave predictably:
Rob
I may be being somewhat picky (or I may even be downright wrong), but I don't see any "unpredictable behaviour" there. I agree that one needs to be careful when modifying an array by iterating over the same array, but the following does behave predictably:
Cheers,use strict; use warnings; my @array = ('a'); foreach (@array) { push @array,'a'; print"@array\n"; sleep(1); # so we can absorb what's happening }
Rob
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: self-feeding infinite loop
by Errto (Vicar) on Aug 18, 2007 at 18:03 UTC |
In Section
Seekers of Perl Wisdom