CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Fun With Perl: Perl Quizzes - Learn Perl the Fun Way:
hash of hash help

 



chefchanyu
New User

Aug 16, 2011, 10:46 PM

Post #1 of 3 (22202 views)
hash of hash help Can't Post

our %test = (
%keys_1 = (),
%keys_2 = ()
);

is it possible to make this work? or any better way to do?


davidbj
Novice

Aug 17, 2011, 5:16 AM

Post #2 of 3 (22200 views)
Re: [chefchanyu] hash of hash help [In reply to] Can't Post

Here's an example:

Code
%HashOfHashes = (  
languages=>{ windows => "PowerShell",
aix => "Perl"
},
systems => { Remotepc1 => "Win32",
Remotepc2 => "Win64",
Remotepc3 => "Aix"
},
viewdir =>{ Win32 => "dir",
Aix => "ls",
Win64 => "dir"
},
);
print "Here is my list of hashes in HashOfHashes:\n--------------------\n";
foreach $keyy(keys %HashOfHashes){
print "$keyy\n";
}
print "\nIm accesing to the first hash, to see what lenguages are available for my windows\n------------------\n";
print $HashOfHashes{languages}{windows};



BillKSmith
Veteran

Aug 18, 2011, 4:14 AM

Post #3 of 3 (22177 views)
Re: [chefchanyu] hash of hash help [In reply to] Can't Post

Refer to perl's documentation. On the command line, type:

perldoc perldoc

to learn to use the tool.

perldoc perldsc

for the example that you want.

perldoc perlref

for details of complex data structures.
Good Luck,
Bill

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives