How can I tell if a URL works or not, from a perl script?
Solution 1: LWP::Simple
The LWP::Simple module provides a simple interface to the LWP (lib-www-perl) modules. The script below will retreive a web page and if the request was successful or not:
This script will print the HTML contents of http://www.perlmeme.org to STDOUT, and will detect whether or not the HTTP request failed.
Solution 2: LWP
The LWP object oriented style allows for more flexible behaviour: