In one of my main (or primary) routines, I have two or more hashes. I want the foo () routine to receive these possibly multiple hashes, like various hashes. Right now I have no preference if they go by value or as links. I have been struggling with this for the last few hours and will be grateful for the help, so I don't need to leave perl for php! (I use mod_perl or will)
I now have an answer to my requirement shown here
From http://forums.gentoo.org/viewtopic-t-803720-start-0.html
# sub: dump the hash values with the keys '1' and '3' sub dumpvals { foreach $h (@_) { print "1: $h->{1} 3: $h->{3}\n"; } }
I only want to expand it so that in dumpvals I can do something like this:
foreach my %k ( keys @_[0]) {
The syntax is wrong, but I suppose you can say that I'm trying to get the keys of the first hash (hash1 or h1) and iterate over them.
How to do this in the last code snippet above?
source share