Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl
    use strict;
    ...
    map { print "\$r{$_->[0]}{$_->[1]} ==> $r{$_->[0]}{$_->[1]}\n" }
    map { [$_,(sort { $r{$_}->{$b} <=> $r{$_}->{$a} } keys %{$r{$_}})[0]]}
      keys %r;
    
  2. or download this
    $r{456}{d} ==> 7
    $r{123}{a} ==> 3
    
  3. or download this
    my %rmax;
    $rmax{$_} = (sort { $r{$_}->{$b} <=> $r{$_}->{$a} } keys %{$r{$_}})[0]
      for keys %r;
    print "\$r{$_}{$rmax{$_}} ==> $r{$_}{$rmax{$_}}\n" for keys %rmax;
    
  4. or download this
    $r{123}{a} ==> 3
    $r{456}{d} ==> 7