#!/usr/bin/perl -l use strict; use warnings; my $tref = { 'vnsgnnwwor-gw-1' => { 'conn' => { 'dur' => '2.09 hours', 'status' => 'red' }, 'mrtg' => { 'dur' => '4.00 hours', 'status' => 'green', }, }, }; my $host = 'vnsgnnwwor-gw-1'; my $test = 'http'; print "$host is ", defined $tref->{$host} ? "True" : "False"; print "$test is ", defined $tref->{$host}{$test} ? "True" : "False"; print "$test=>status is ", defined $tref->{$host}{$test}{status} ? "True" : "False"; print "$test is ", defined $tref->{$host}{$test} ? "True" : "False";