use strict; # use warnings; use Win32::TieRegistry(Delimiter=>'/'); my ($idval, $k1); $idval = $Registry->{"HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/0//Identifier"}; print "IDVAL: $idval\n"; $k1 = $Registry; print "\nregistry top level - $k1\n"; PrintHash($k1); $k1 = $Registry->{"HKEY_LOCAL_MACHINE"}; print "\nHKEY_LOCAL_MACHINE - $k1\n"; PrintHash($k1); $k1 = $Registry->{"HKEY_LOCAL_MACHINE/HARDWARE"}; print "\n$k1\n"; PrintHash($k1); sub PrintHash { my ($hashref, $indent) = @_; my %hash = %{$hashref}; $indent += 2; my $maxsize = 0; foreach my $key (keys %hash) { $maxsize = length $key if (length $key > $maxsize); } foreach my $key (sort keys %hash) { printf "%*sKey: %-*s Value: %s\n", $indent, "", $maxsize, $key, $hash{$key}; if (ref $hash{$key} eq 'ARRAY') { PrintArray($hash{$key}, $indent); } if (ref $hash{$key} eq 'HASH') { PrintHash($hash{$key}, $indent); } } } sub PrintArray { my ($array, $indent) = @_; my @arr = @{$array}; $indent += 2; my $cnt = 0; foreach my $elem (@arr) { printf("%*s%2d. %s\n", $indent, "", $cnt, $elem); if (ref $elem eq 'ARRAY') { PrintArray($elem, $indent); } if (ref $elem eq 'HASH') { PrintHash($elem, $indent); } ++$cnt; } }