in reply to Re^3: split every other value
in thread split every other value

If you do away with the conditionals like that, the temporaries in the while loop are superfluous.

my ( @arr0, @arr1 ); while( @array > 1 ) { push @arr0, shift @array; push @arr1, shift @array; } push @arr0, shift @array if @array;

Or you could pull the conditional back into the loop:

my ( @arr0, @arr1 ); while( @array ) { push @arr0, shift @array; push @arr1, shift @array if @array; }

Makeshifts last the longest.

Replies are listed 'Best First'.
Re^5: split every other value
by beable (Friar) on Aug 07, 2004 at 01:52 UTC
    Yep looks good to me.