in reply to extract uniques and sort
Here's what I ended up with for extracting uniques and sorting. I know it can be further simplified, but my non-programmer brain can somewhat grok it as is. Thanks again, all!
cheers,
ybiC
cheers,
ybiC
#!/usr/bin/perl -w use strict; my $infile = shift; my $outfile = shift; my %seen; open (IN, "<$infile") or die "Can't open $infile RO: $!"; open (OUT, ">$outfile") or die "Can't open $outfile RW: $!"; foreach my $item (<IN>) { # parse $infile into a hash and remove + duplicate keys ++$seen{$item}; } print OUT sort keys %seen; # sort keys and save to $outfile close IN or die "Cannot close $infile: $!"; close OUT or die "Cannot close $outfile: $!";
In Section
Seekers of Perl Wisdom