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";
      }