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

8 lines
157 B
Perl
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
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";