#!/usr/bin/perl
use strict; use warnings; use List::Permutor; my $OutFile = '>permutations.txt'; open(OUTFILE, $OutFile) or die "The file $OutFile could not be found.\n"; my $word = 'aabc'; my $perm = new List::Permutor split(//,$word); while (my @set = $perm->next) { #print @set for(my $i=0; $i## #!/usr/bin/perl use warnings; use strict; chdir('//Users/laptop/Desktop/') or die ("Sorry could not change to the perl/programs directory.\n"); my $AllPermutations = 'permutations.txt'; #INFILE open(ALLPERMUTATIONS, $AllPermutations) or die "File: $AllPermutations failed to open: $!\n"; my $UniqPermutations = '>unique_permutations.txt'; #OUTFILE open(UNIQPERMUTATIONS, $UniqPermutations) or die "The file $UniqPermutations could not be found.\n"; my @AllPermutations = ; my %seen = (); my @unique = grep { ! $seen{ $_ }++ } @AllPermutations; print "@unique"; my $str = "@unique"; print join(",",split(//,$str)); close(ALLPERMUTATIONS); close(UNIQPERMUTATIONS);