Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: printing largest hash value

by demerphq (Chancellor)
on Feb 22, 2005 at 09:06 UTC ( [id://433288]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my %hash=();
    my $highest;
    my @highest=grep {defined $highest ? $hash{$_}==$highest : (($highest=
    +$hash{$_}),1) } 
                sort { $hash{$b} <=> $hash{$a} || $a cmp $b } 
                keys %hash;
    
  2. or download this
    my %hash=();
    my %rev;
    ...
      $highest=$hash{$_} if $highest < $hash{$_};
    }
    print sort keys %{$rev{$highest}};
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://433288]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-03-29 08:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found