sub cpu_stats { my @cpustats; open STAT_FILE, "/proc/stat" or warn "Couldn't open /proc/stat: $!\n"; my $line = ; @cpustats = $line =~ /^cpu\s+(\d+) (\d+) (\d+) (\d+)/; close STAT_FILE; return(@cpustats); }