http://qs321.pair.com?node_id=1130323


in reply to Net::Ping blowed my mind

Welcome to the monastry, you need to chomp $url to remove the newline from the end of the url.

It is also highly recommended that you use strict and warnings, believe me it is well worth it.

Here is a modified version of your script which includes a print before and after a chomp to highlight the difference.

use strict; use warnings; use Net::Ping; my $url = <>; print ":$url:\n"; chomp($url); print ":$url:\n"; my $p = Net::Ping->new(); if ( $p->ping($url) ) { print "working\n"; } else { print "not working\n"; }
Output: :www.bbc.co.uk : :www.bbc.co.uk: working