programming-examples/perl/Network/Send a TCP or UDP ping.pl

8 lines
198 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
#!/usr/bin/perl
use warnings;
use Net::Ping;
$hostname = shift @ARGV;
$p = Net::Ping->new("icmp"); #could be "udp" or "tcp" instead
print "$host is alive.\n" if $p->ping($host);
$p->close();