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