use Net::Ping; my $ping = Net::Ping->new ( "tcp", 1 ); $ping->port_number ( 22 ); $ping->ping ( $host );