#!/usr/bin/perl use strict; use warnings; use Net::Ping; my $p = Net::Ping->new(); for(1..254){ my $host = '192.168.2.'.$_; print "$host is "; print "NOT " unless $p->ping($host, 2); print "reachable.\n"; sleep(1); }