http://qs321.pair.com?node_id=172873

smackdab has asked for the wisdom of the Perl Monks concerning the following question:

Hi, this works and I would like to know how Perl keeps track of its place in the shrinking array...so I can sleep better ;-)

use strict; my @list = (1,2,3,4,5); foreach (@list) { if ($_ == 2 || $_ == 4) { unshift (@list); next; } print "$_\n"; }