top -b -n 1 | grep ^CPU #### while(){ next unless /^CPU.*? ([0-9.]+)% idle, ([0-9.]+)% user/; my ( $idle, $user ) = ( $1, $2 ); ... last; }