#Author: Matt Pawlaczyk #Date: 1-6-2017 #Desc: This script takes in a URL and continuosly pings it. The IP equivalent of the hostname is returned # and a message displays to indicate if it is online or not. use strict; use warnings; use 5.010; use Socket; use Net::Ping; #acquire a host to ping from the user print "Enter a website to ping:\n"; my $input = ; chomp $input; #get the IP address for the hostname my $address = inet_ntoa(inet_aton($input)); #a ping object is created, the protocol by default is TCP, changed to icmp my $p = Net::Ping->new("icmp"); #ping the inputted website to see if it is live or not. (we do this 10 times) print "Attempting to ping $input.....\n"; for(my $i = 1; $i <= 10; $i = $i++){ if ($p->ping($input)) { print "Response from $address succesful\n"; #delay execution by 1 second sleep(1); } else { return undef; print "No response from server, try again.\n"; } } print "Done."; #### Use of uninitialized value in subroutine entry at pingTest.pl line 16, line 1. Bad arg length for Socket::inet_ntoa, length is 0, should be 4 at pingTest.pl line 16, line 1.