in reply to (Golf) Ordered Combinations
sub c{my$n=pop;--$n?map{my$c=$_;map$c.$_,c(@_,$n)}@_:@_}
Example:
print join " ", c qw(a b c 2); print "\n"; print join " ", c qw(0 1 4); print "\n"; [download]