in reply to recursive exists in perl

I'm not sure whether you'd consider this more compact, but it does make it easier to see the path of keys you're checking:
use List::Util 'reduce'; if (reduce { $a && exists $$a{$b} ? $$a{$b} : undef } \%foo, 'bar', 'baz', 'troz') { }