List::UtilsBy
use List::UtilsBy qw( count_by rev_nsort_by ); use List::Util qw( pairs ); use Proc::ProcessTable qw(); printf("%-10s => %4u\n", $_->key, $_->value) foreach rev_nsort_by { $_->value } pairs count_by { scalar getpwuid($_->uid) } @{ Proc::ProcessTable->new->table };