@outrecs = `ps -efo pid,pcpu,fname`; @matches = grep /ns-httpd/, @outrecs; foreach (@matches) { $ct++; chomp; ($process, $pcpu, $pname) = split(" "); $sttotal = $sttotal + $pcpu; }