Help for this page
@copy = @$r; while (my @pair = splice @copy, 0, 2) { push @$r2, [@pair]; }
@copy = @$r; # I guess you know that your array will work for this, but ... # next if $_%n push @$r2, [$copy[$_],$copy[$_+1]]; }