From Programming Perl(The Camel), 3rd Edition, Page 56, Second paragraph:
Variables attached to a lexical scope are not in any package, so lexically scoped variable names may not contains the :: sequence. (Lexically scoped variables are declared with a my declaration.)
Remove the main:: and make it $HKEY_LOCAL_MACHINE.