in reply to Re: Re: testing for ip resolutions of a hostname
in thread testing for ip resolutions of a hostname

Ah! The lightbulb dimly illuminates!

Howzabout wrapping the lookup functions in a sub and replacing the 'die's with returns. Untested, BTW ... hopefully no typos ...

my $ip = lookup ( $host ) or warn "Cannot resolve $host!\n"; sub lookup { my $host = shift; my $i = gethostbyname($host) or return undef; my $ip = inet_ntoa($i) or return undef; return $ip; }

HTH
--
idnopheq
Apply yourself to new problems without preparation, develop confidence in your ability to to meet situations as they arrise.