in reply to hashes in the Nth dimension
I'm not sure if I understand your question.
Your general idea isn't syntactically correct. Is this what you mean?
use strict; use warnings; my %meows = ( kittehs => { purr => "happy", hiss => "mad", weather => { tailflic => "rain", shaking => "a doosy", }, }, ) sub func { my $h_ref = shift; my $cur = $h_ref; for my $k (@_) { $cur = $cur->{$k} } return $cur; } print $meows{"kittehs"}->{weather}->{tailflic}, "\n"; print func( \%meows, "kittehs", "weather", "tailflic"), "\n"; __END__ rain rain
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: hashes in the Nth dimension
by perlaintdead (Scribe) on Jan 11, 2014 at 05:54 UTC | |
|
Re^2: hashes in the Nth dimension
by perlaintdead (Scribe) on Jan 11, 2014 at 05:55 UTC |