use Getopt::Long; use Win32::TieRegistry; use Win32API::Registry qw( regLastError ); my ($machine, $help, $remote_key, $entry); my $root_key = "HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/allisbus/Parameters/Session"; GetOptions( "h" => \$help, "m" => \$machine, ); if ($machine) { $machine = "//$machine" } $Registry->Delimiter("/"); $remote_key = $Registry->{"$machine/$root_key"} or die "Can't read $root_key: ", regLastError(), "\n"; while (($key, $value) = each(%$remote_key)) { if ($key =~ /allisbus/) { print "Found: $key\n"; } print "Reg key\t: $key, Reg value\t: $value \n"; }