mpapec

101
reputation
2

Users with best score/answer ratio

perl -MpQuery -MData::Dumper -e '*Q = *pQuery;
print Dumper map [
    sort { $b->{ratio} <=> $a->{ratio} }
    map {
        @h{qw(s a u)} = map Q($_)->text,
          @{ Q($_)->find("td") };
        s/k// and $_ *= 1000 for @h{qw(s a)};
        $h{ratio} = $h{s}/$h{a};
        +{%h};
    } @{ Q($_)->find("tr") }
], @{ Q(pop)->find(".fl") }[0,1];
' http://stackoverflow.com/tags/perl/topusers