use Win32::TieRegistry( Delimiter=>"/" ); unless( $remoteKey= $Registry->{"//$pserver/LMachine/SYSTEM/" . "CurrentControlSet/Control/Print/Monitors/"} and $remoteKey->SubKeyNames() and $remoteKey= $remoteKey->{"HP Standard TCP/IP Port/"} and $remoteKey= $remoteKey->{"Ports/$portname/"} ) { die "Can't read the port key on $pserver: $^E\n"; }