Fellow Monks, I am writing a script that will search our domain and get cpu infomation via the registry. After completing it, the manager wanted the 9x info as well. There is no clean way to get that info via the registry so I decided to hard code the info in a hash of hash of lists. Reason is that there are a few domains and he wanted the info for each domain. I am trying to call it in this fashion:

my %win9x = ( domain1 => { Test98 => [ "Windows 98", , 1, 233, 128], TestME => [ "Windows Me", , 1, 233, 64], Win981 => [ "Windows 98SR2", , 1, 600, 512], Win982 => [ "Windows 98SR2", , 1, 600, 512], WinME1 => [ "Windows Me", 1, , 600, 512], WinME2 => [ "Windows Me", 1, , 600, 512] } ); unless ($domain = shift) { @ARGV = Win32::DomainName or die "Unable to obtain the domain +name\n"; } foreach $domain (@ARGV) { print "\nDOMAIN:\t$domain\n\n"; AddWin9x{%win9x}; }

The sub routine will not work because it reports. Can't locate object method "AddWin9x" via package "DOMAIN1" (perhaps you forgot to load "DOMAIN1"?)

sub AddWin9x { my %hoh = shift or next;; my $computer; my $os; my $cpu; my $mhz; my $ram; my $sp; print "\n\nWindows 98//Me\n\n"; foreach {$hoh{$domain{$computer}}) { ($os, $sp, $cpu, $mhz, $ram) = $computer; printf ("%20s %3s %-15s %3s %4s %5s\n",$computer, $os, + $cpu, $mhz, $ram); } }

The sub I have not tested out because I have not gotten that far. Sorry but my head hurts from banging it on the desk! Thanks for any suggestions!


In reply to Trying to pass a hash of hash of lists by Marza

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.