perl – 列出 CPU 資訊

忘記當時寫這個要做什麼 XD

#! /usr/bin/perl

open(INFO,"top -b -n 1|");
open(CPUCORES, "cat /proc/cpuinfo | grep processor | tail -n 1 | awk '{print $3 + 1}'");

print();

while(){
  if ($_ =~ /^\s+[0-9]/){
    @word=split(/\s+/,$_);
    if ($word[9] ge 90){
      print($word[12],$word[2],$word[9], $word[10], $word[11]);
      print("\n");
    }
  }
}