rjulich has asked for the wisdom of the Perl Monks concerning the following question:
I have 4 hash tables and I want to loop through array and then through each hash table.
Array of Hashes:
@array = (%hash0, %hash1, %hash2, %hash3); for($i = 0; $i < 4; $++) { foreach $key(key "%hash[$i]" or "$array[$i]") { print "$key\n"; } }
I know that %hash$i isn't the correct way to do this, but how do I do this? Let me know if I can provide any other information.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Loop through array of hashes
by johngg (Canon) on Jan 21, 2016 at 18:11 UTC | |
|
Re: Loop through array of hashes
by hippo (Archbishop) on Jan 21, 2016 at 18:14 UTC | |
|
Re: Loop through array of hashes
by jeffa (Bishop) on Jan 21, 2016 at 18:51 UTC | |
by GotToBTru (Prior) on Jan 21, 2016 at 20:42 UTC | |
by Anonymous Monk on Jan 21, 2016 at 21:49 UTC |