use strict;
use warnings;
use feature 'say';
use Algorithm::Combinatorics qw(permutations);
my $zeros = 7;
my $ones = 3;
my %seen;
# this is really ugly
# say join '', @$_ for grep{ !$seen{join('', @$_)}++ } permutations( [
+ (0) x $zeros, (1) x $ones] );
# a little nicer
say for grep { !$seen{$_}++ } map{join '', @$_} permutations( [(0) x $
+zeros, (1) x $ones] );
Now the cure is worst than the disease, but runs ok
L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
|