SuzuBell has asked for the wisdom of the Perl Monks concerning the following question:
Hello Perl Monks:
I want to print an array of 20 hashes. Each hash has 2 types of keys.
I am not too particular about how to print. I am just doing this to check that the array has all 20 hashes working, where the correct value is associated with the correct two keys. One way I might like to check the array (if possible) is to print the values from each hash of the array (That is, check that hash1 has the correct values with the correct key1s and key2s, then check that hash2 has the correct values with the correct key1s and key2s, ....).
This is the general idea of my code. The values of all hashes are all strings or empty strings.
sub getArrayHash{ $hash1s->{$key1}->{$key2} = $hash1; $hash2s->{$key1}->{$key2} = $hash2; $hash3s->{$key1}->{$key2} = $hash3; . . . $hash20s->{$key1}->{$key2} = $hash20; push( @hash_array, $hash1s, $hash2s, $hash3s, ..., $hash20s); return \@hash_array; }
So, any ideas on how to check that my hash_array has the correct values? Thank you in advance!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Array of Hashes
by Gangabass (Vicar) on Mar 21, 2013 at 04:07 UTC | |
|
Re: Array of Hashes
by NetWallah (Canon) on Mar 21, 2013 at 04:19 UTC | |
|
Re: Array of Hashes
by rjt (Curate) on Mar 21, 2013 at 07:50 UTC | |
|
Re: Array of Hashes
by kcott (Archbishop) on Mar 21, 2013 at 06:14 UTC |