grep { my @split = split /\|/,$user{$_}; $split[4] && defined $foo{ $split[4] }; } keys %user