http://www.perlmonks.org?node_id=30208

Probably not the shortest way to do this, but has to get bonus points for inefficiency:
$x=length+(sort map 1x y===c, keys%h)[-1];