smackdab has asked for the wisdom of the Perl Monks concerning the following question:
use strict; my @list = (1,2,3,4,5); foreach (@list) { if ($_ == 2 || $_ == 4) { unshift (@list); next; } print "$_\n"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: walking an array and unshifting
by graff (Chancellor) on Jun 09, 2002 at 03:42 UTC | |
by smackdab (Pilgrim) on Jun 09, 2002 at 03:53 UTC | |
by graff (Chancellor) on Jun 09, 2002 at 03:56 UTC | |
by smackdab (Pilgrim) on Jun 09, 2002 at 05:23 UTC | |
by dsheroh (Monsignor) on Jun 09, 2002 at 14:30 UTC | |
by Util (Priest) on Jun 09, 2002 at 19:38 UTC | |
Re: walking an array and unshifting
by tadman (Prior) on Jun 09, 2002 at 05:56 UTC | |
by merlyn (Sage) on Jun 09, 2002 at 15:52 UTC | |
A reply falls below the community's threshold of quality. You may see it by logging in. |