my $service = $services{ $user_request }; if ( not $service->{ host }{ $current_host } ) { # error here } else { # real work here }