Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^7: String sorting in Perl

by Laurent_R (Canon)
on Jun 04, 2014 at 19:06 UTC ( #1088723=note: print w/replies, xml ) Need Help??


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

Change the last lines to:
for my $line (sort { length $a <=> length $b || $count_hash{$b} <=> $c +ount_hash{$a}} keys %count_hash) { chomp $line; print "$line\t$count_hash{$line}\n"; }
(Or you also could chomp the data before.)

Replies are listed 'Best First'.
Re^8: String sorting in Perl
by markdavis87 (Novice) on Jun 04, 2014 at 19:47 UTC

    Haha, that's exactly what I did before I read your post. Thanks for all the help! I really appreciate it.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1088723]
help
Chatterbox?
[Corion]: ;)
[Discipulus]: for the moment I just lead the Perl 99 bottle of beer ladder..
[Discipulus]: fibonacci in 34.. uh!!

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2017-10-20 09:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (260 votes). Check out past polls.

    Notices?