in reply to All possible number combinations in perl
all possible combinations of the number 1..n
use Algorithm::Combinatorics qw[ combinations ];; for my $k ( 1 .. 3 ) { my $i = combinations( [ 1..3 ], $k ); print @$_ while defined( $_ = $i->next ); };; 1 2 3 1 2 1 3 2 3 1 2 3
|
|---|