1#!/usr/bin/perl 2 3use strict; 4use warnings; 5 6use Win32API::Registry 0.21 qw( :ALL ); 7 8 9my $key; 10my $i = 0; 11while (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\$i", 0, KEY_READ, $key)) { 12 $i++; 13 RegCloseKey($key); 14} 15 16print "$i\n"; 17