my %db; tie(%db, 'NDBM_File', ...); my $userdata = \%{$db{userdata}}; my $config = \%{$db{config}}; if ($userdata->{foo} && $config->{key}) { # ... }