#!/usr/bin/perl -w use Net::Ping; foreach $IP ("192.168.0.4","192.168.0.21","192.168.0.34") { $p = Net::Ping->new(); next unless $p->ping($IP); $p->close; }