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

8 lines
157 B
Perl

use ntheory "forcomb";
my @S = qw/a b c/;
for $k (0..@S) {
# Iterate over each $#S+1,$k combination.
forcomb { print "[@S[@_]] " } @S,$k;
}
print "\n";