RosettaCodeData/Task/Power-set/Perl/power-set-1.pl

9 lines
168 B
Perl
Raw Permalink Normal View History

2015-11-18 06:14:39 +00:00
use Algorithm::Combinatorics "subsets";
my @S = ("a","b","c");
my @PS;
my $iter = subsets(\@S);
while (my $p = $iter->next) {
push @PS, "[@$p]"
2014-04-02 16:56:35 +00:00
}
2015-11-18 06:14:39 +00:00
say join(" ",@PS);