in reply to hashes in the Nth dimension
Here is another approach using the Hash::Flatten module:
#! perl use strict; use warnings; use Hash::Flatten 'flatten'; my %meows = ( kittehs => { purr => 'happy', hiss => 'mad', weather => { tailflic => 'rain', shaking => 'a doosy', }, }, ); my $flat_meows = flatten(\%meows); my @keys = qw(kittehs weather tailflic); my $new_key = join '.', @keys; printf "\$meows{%s} = %s\n", $new_key, $flat_meows->{$new_key};
Output:
18:26 >perl 831_SoPW.pl $meows{kittehs.weather.tailflic} = rain 18:26 >
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|