in reply to Obtaining data from the top command via a pipe

Do you need this in perl? From command line, it would just be:
top -b -n 1 | grep ^CPU
if you want it in perl, probably (other ways of course) want a loop something like:
while(<PIPE>){ next unless /^CPU.*? ([0-9.]+)% idle, ([0-9.]+)% user/; my ( $idle, $user ) = ( $1, $2 ); ... last; }