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 };
root => 141 grant => 67 www-data => 8 postgres => 6 avahi => 2 kernoops => 1 mongodb => 1 rtkit => 1