#!/usr/bin/perl -w use strict; unlink "/tmp/prochogs.$$" if (-e "/tmp/prochogs.$$"); system ("top -u -h -d1 -s1 -f /tmp/prochogs.$$"); open (TOP,"/tmp/prochogs.$$") or die "Unable to open top file - $!"; my %Proc; my $FoundList; while () { if (/^CPU/) { $FoundList = 1; next; } next unless ($FoundList); my @Values = split; $Proc{$Values[2]} = \@Values; } foreach(keys %Proc) { print "$_ : $Proc{$_}->[11]\n"; }