in reply to Re: String sorting in Perl
in thread String sorting in Perl

That last anonymous post was me... Sorry! I figured I should give you the full code I'm using to test this out. Here it is:

#!/usr/bin/perl -w use strict; my $file = "my path to the file name"; open (FH, "< $file") or die "Can't open $file for read: $!"; my @data = <FH>; close FH or die "Cannot close $file: $!"; my %count_hash; for my $line (@data) { $count_hash{$line} ++; } my @sorted_data = sort { length $a <=> length $b || $count_hash{b} <=> + $count_hash{$a} } keys %count_hash; print @sorted_data; # see if it worked