How can I take two hashes, combine them to make a hash of hash, and then loop through the hash of hash one slice at a time and print out the variables.
Yes, I want to combine two separate hashes into one hash of hash, and then loop through the hash of hash and print out each slice using a write statement.
Thanks for the reply! Can you humor a newbie here and explain a few things. If my hashes are already populated, why am I assigning them to what looks like different values with:
%hash1=(
a => 1,
b => 2
);
%hash2=(
c => 3,
d => 4
);
If they are already populated in my script can I skip the above?
Also for this part:
%hashhash= (
rh1 => \%hash1,
rh2 => \%hash2
);
why do I need to backslash the hash variable name?
Also, I am not looking to print out %hashhash but input each slice to a write statement. Is that as simple as replacing the prints with a write? Also, in my format for the write statement, what variables should I use?
Also finally, is there a tutorial somewhere that explains all this? I have three perl books I am using to learn and none seem to explain it so I can understand it easily.
Sorry for all the extra questions, but I really want to learn thuis stuff!
>>If they are already populated in my script can I skip the above?
Yes .
>>why do I need to backslash the hash variable name?
Thats the way to reference a hash.
References are Perl's equivalent for pointers in C.
For a start on References , try 'perldoc perlreftut' & 'perldoc perlref' on your prompt.
>>I am not looking to print out %hashhash but input each >>slice to a write statement. Is that as simple as >>replacing the prints with a write? Also, in my format for >>the write statement, what variables should I use
Im not sure what needs to be accomplished here ...maybe some examples might help.
>>Also finally, is there a tutorial somewhere that explains >>all this?
Yes ....Sriram Srinivasan's Advanced Perl Programming is really good and sufficient for References
Also 'perldoc perllol', 'perldoc perldsc' 'perldoc perlfaq4' on your prompt might help.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.