require LWP::UserAgent; use Data::Dumper; use strict; use warnings; my $res = LWP::UserAgent->new()->get('http://www.hopingthereisnosuchthing.com/ah'); print "return code = $res->{'_rc'}\n"; print "msg = $res->{'_msg'}\n"; #### return code = 500 msg = Can't connect to www.hopingthereisnosuchthing.com:80 (Bad hostname 'www.hopingthereisnosuchthing.com')