use Win32::TieRegistry(Delimiter=>'/'); my $idval = $Registry->{"HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/0//Identifier"}; #### Use of uninitialized value $idval in concatenation (.) or string at C:\Users\ ... \TieRegistry.pl line 9. #### Key: CConfig/ Value: Win32::TieRegistry=HASH(0x2a184b4) Key: CUser/ Value: Win32::TieRegistry=HASH(0x2a1834c) Key: Classes/ Value: Win32::TieRegistry=HASH(0x2a189ac) Key: DynData/ Value: Key: LMachine/ Value: Win32::TieRegistry=HASH(0x2f8d7ec) Key: PerfData/ Value: Key: Users/ Value: Win32::TieRegistry=HASH(0x2f8d1ec) #### Key: BCD00000000/ Value: Key: DRIVERS/ Value: Key: HARDWARE/ Value: Key: SAM/ Value: Key: SECURITY/ Value: Key: SOFTWARE/ Value: Key: SYSTEM/ Value: #### 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; } } #### IDVAL: registry top level - Win32::TieRegistry=HASH(0x2a993bc) Key: CConfig/ Value: Win32::TieRegistry=HASH(0x2a184b4) Key: CUser/ Value: Win32::TieRegistry=HASH(0x2a1834c) Key: Classes/ Value: Win32::TieRegistry=HASH(0x2a189ac) Key: DynData/ Value: Key: LMachine/ Value: Win32::TieRegistry=HASH(0x2f8d7ec) Key: PerfData/ Value: Key: Users/ Value: Win32::TieRegistry=HASH(0x2f8d1ec) HKEY_LOCAL_MACHINE - Win32::TieRegistry=HASH(0x2f8d1d4) Key: BCD00000000/ Value: Key: DRIVERS/ Value: Key: HARDWARE/ Value: Key: SAM/ Value: Key: SECURITY/ Value: Key: SOFTWARE/ Value: Key: SYSTEM/ Value: Can't use an undefined value as a HASH reference at C:\Users\James\Portable\strawberry-perl-5.24.0.1-32bit-portable\Perl Source\TieRegistry.pl line 28.