use Scalar::Util qw(); sub GET::AUTOLOAD { $GET::AUTOLOAD =~ /::(\w+)$/; $_[0]->{ $1 }; } sub getter { my $h = $_[0]; my $r = Scalar::Util::reftype($h) or return; if ($r eq 'ARRAY') { getter($_) for @$h; } elsif ($r eq 'HASH') { bless $h, 'GET'; getter($h->{$_}) for keys %$h; } $h; }