#!/usr/bin/perl use strict; use warnings; use Math::Combinatorics; my @list = qw(Alpha Beta Caesar Delta); for( 2 .. scalar(@list) ){ my $comb = Math::Combinatorics->new( count => $_, data => [@list], ); while( my @perms = $comb->next_combination ){ print join( ' ', @perms ), "\n"; } }