ovedpo15 has asked for the wisdom of the Perl Monks concerning the following question:
I had a hash that has files as keys and timestamps as values. But now I have changed the hash a little.convertToFile($dir,$name,@data);
hash after:$newHash{$file} = $time;
I were passing the hash keys as array to the convertToFile function:$newHash{$dir}{$file} = $time;
But now it won't work because I need the nested hashes.convertToFile($dir,$name,sort(keys(%data)));
What if I have two keys (which are directories) that are the same? will it combine the inner hashes?%full = (%files1,%files2);
How the new hash will look like?$files1 = { 'ABC' => { 'file1' => 6 'file2' => 5 'file3' => 8 } 'XYZ' => { 'file5' => 6 'file2' => 5 'file8' => 8 } }; $files2 = { 'ABC' => { 'file1' => 9 'file8' => 5 'file3' => 8 } };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how to get all keys of inner hashes
by 1nickt (Canon) on Jan 10, 2019 at 14:41 UTC | |
|
Re: how to get all keys of inner hashes
by Laurent_R (Canon) on Jan 10, 2019 at 15:02 UTC | |
|
Re: how to get all keys of inner hashes
by hippo (Archbishop) on Jan 10, 2019 at 15:27 UTC | |
|
Re: how to get all keys of inner hashes
by choroba (Cardinal) on Jan 10, 2019 at 15:54 UTC | |
by ovedpo15 (Pilgrim) on Jan 10, 2019 at 15:56 UTC | |
by poj (Abbot) on Jan 10, 2019 at 17:02 UTC |