"Wheldon,M" <[EMAIL PROTECTED]> wrote:
> Being relativly new to Perl could someone please explain why the
> following doesn't work on a win2k pro box the problem is that the
> registry
> key is not being opened
<snip>
Because the long registry key got wrapped, it's kind of hard to tell what
you're actually trying to do. If you're trying the equivalent of
$CompName = $Registry{"LMachine/System/CurrentControlSet"}
{"Control/ComputerName/Computer Name/"};
the problem is that NT has no such key. Specifically, there is no space in
the last key, at least under Windows 2000. It wants
$CompName = $Registry{"LMachine/System/CurrentControlSet"}
{"Control/ComputerName/ComputerName/"};
which works just fine. You can not in general assume that registry names
are the same between Windows and NT, or even between versions of NT. You
might need to do something like
use Win32;
$lastkey = Win32::IsWinNT () ?
'ComputerName' : 'Computer Name';
$CompName = $Registry{"LMachine/System/CurrentControlSet"}
{"Control/ComputerName/$lastkey/"};
Tom Wyant
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs