#!/usr/bin/perl use strict; use warnings; use Net::Ping; my $p = Net::Ping->new(); print "127.0.0.1 is alive.\n" if $p->ping('127.0.0.1'); $p->close();