my $r = do { $pkg_ref = $r->{$_."::"} for split(/::/, $pkg); \($pkg_ref->{$var}) };