- or download this
my $query = $db->prepare("select code, username, userid from transacti
+ons");
$query->execute();
- or download this
my %code = map { $_ => [] } 0 .. 13;
- or download this
while (my $r = $qeury->fetchrow_hashref()) {
- or download this
my $c = $$r{code};
push @{$code{$c}}, $r;
...
# contains the relevant records (as hashrefs). The
# number of elements in the array equals the number
# of occurances. Now, for the second part...
- or download this
my %topfive;
for my $c (keys %code) {
...
[$_, $user{$_}{name}, $user{$_}{count}]
} keys %user)[0 .. 4]];
}