Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Re: count sort & output

by jdporter (Paladin)
on Dec 19, 2002 at 03:29 UTC ( [id://221031]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
      if (defined($hash{$key}) {
        $hash{$key} ++;
      } else {
        $hash{$key} = 1;
      }
    
  2. or download this
        $hash{$key}++;
  3. or download this
      %hash = ("www.yahoo.com", 10, "www.google.com", 2000);
      foreach (keys %hash) {
        $rev_hash{$hash{$_}} = $_;
    ...
      foreach (sort keys %rev_hash) {
        print "$rev_hash{$_} appears: $_ time(s)\n";
      }
    
  4. or download this
      %hash = (
         www.yahoo.com => 10,
         www.google.com => 2000,
    ...
        print "$_ appears: $hash{$_} time(s)\n";
      }
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-07-17 20:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.