use AnyEvent::Ping::TCP; my $t = tcp_ping '10.0.0.2', 1235; my $result = defined $t ? "OK" : "Failed"; print $result."\n";