sub doubleStack { my $count = pop; my @out; while (@_){push @out, [splice @_,0,$count];} return @out; }