I have a very simple tab delimited file containing text and numbers ,
just the 2 columns and I would like to sort by ascending numeric. I have
checked Learning Perl and Prog Perl but cannot get it to work - is that
because you can only sort by key or am I using the wrong approach
entirely?

my @fields = qw/Text Time/;
my %ch;
foreach my $key (sort { $ch{1} cmp $ch{2} }  keys %ch ) {
   print OUT "$key: $ch{$key} \n"; # show key and value
 }

Thanks,

Mark Bedish


Reply via email to