open FILE, "/proc/cpuinfo"; while() { if (/processor/) { $num_cpus++; } } close FILE; print $num_cpus;