Baratski has asked for the wisdom of the Perl Monks concerning the following question:
I'd like to ask a question regarding arrays and using/changing their contents from a loop.
For example:
Obviously the original array isn't changing.@array = qw/v w x y z/; for(1 .. $nn) { # I was expecting the array to shift # at every loop, and I could call on # the first position every time. print OUT $array[0] , "\n"; $slide = shift(@array); push(@array, $slide); }
Thank you.
-Baratski
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Pushing arrays around inside a loop ;-)
by davido (Cardinal) on Jan 06, 2005 at 08:07 UTC | |
by Baratski (Acolyte) on Jan 06, 2005 at 09:42 UTC | |
by demerphq (Chancellor) on Jan 06, 2005 at 09:57 UTC | |
by Baratski (Acolyte) on Jan 06, 2005 at 10:29 UTC | |
|
Re: Pushing arrays around inside a loop ;-)
by ColtsFoot (Chaplain) on Jan 06, 2005 at 08:04 UTC | |
|
Re: Pushing arrays around inside a loop ;-)
by gube (Parson) on Jan 06, 2005 at 09:50 UTC |