in reply to Re: Processing arrays 2 elements at a time (TIMTOWTDI)
in thread Processing arrays 2 elements at a time (TIMTOWTDI)
So don't make your copy first. It's a reference after all, which in this case makes life easy.
This way we build our new array (while the one gets bigger, the other gets smaller), then we simply change what the reference points to.my @copy; while (@$r) { push @copy, [ shift @$r, shift @$r ]; } $r = \@copy;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Re: Processing arrays 2 elements at a time (TIMTOWTDI)
by petral (Curate) on Aug 02, 2002 at 21:50 UTC | |
by ichimunki (Priest) on Aug 02, 2002 at 22:38 UTC |
In Section
Meditations