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