#!/usr/bin/env perl use strict; use warnings; for my $dest ('www.google.com', 'www.perlmonks.org', 'microsoft.com', 'foo.bar') { system ("ping -nqc1 -w 3 -W 3 $dest > /tmp/ping.log") and print "### $dest is unreachable\n"; } #### #!/usr/bin/env perl use strict; use warnings; use Net::Ping; my $pinger = Net::Ping->new ('icmp', 3); for my $dest ('www.google.com', 'www.perlmonks.org', 'microsoft.com', 'foo.bar') { $pinger->ping ($dest) or print "### $dest is unreachable\n"; } $pinger->close;