#!/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);