use Tie::CPHash; $foo = rectie({ bla => { foo => { bar => "a"} } }); warn $foo->{BLA}->{FOO}->{BAR}; sub rectie { my($hashref) = @_; while(my($k,$v) = each %$hashref) { if (UNIVERSAL::isa($v, "HASH")) { my $new_v = rectie($v); $hashref->{$k} = $new_v; } } tie my %newhash, "Tie::CPHash"; %newhash = %$hashref; \%newhash; }