foreach my $pation (@occupation) { `ps -ef|grep -i $pation|grep -v grep|wc -l`; } #### my @programs = qw(netman jobman mailman batchman writer); my @all_procs = `ps -ef`; my %counts; for (@programs) { $counts{$_} = scalar grep {/$_/i} @all_procs; } print "$_ $counts{$_}," for keys %counts; print "\n";