Help for this page

Select Code to Download


  1. or download this
    sub find_groups(&\@)
    {
    ...
        \%groups
    }
    
  2. or download this
    my $groups_hr = find_groups { $_->{'name'} } @rows;
    
    ...
        print "$k\t" . @{$groups_hr->{$k}} . "\n";
    }
    
  3. or download this
    find_groups { join $;, @{$_}{qw( name game score )} } @rows;
    
  4. or download this
    find_groups {
        $_->{'name'} eq 'foo' ? 1 :
        $_->{'game'} =~ /bar/ ? 2 :
        $_->{'score'} >= 500  ? 3 : 0
    } @rows;
    
  5. or download this
    use List::Util qw( sum );
    
    ...
        print "$k\t$avg\n";
    }
    
  6. or download this
        map { $_->{'score'} } @rows