#!/usr/bin/perl -w use strict; use LWP::Simple; my $url; my $site; print "URL to check: "; chomp($url = <STDIN>); $site = get($url); if($site) { print "$url is good.\n"; } else { print "$url appears to be broken.\n"; } Sample run with output: C:\perl>perl linkcheck.pl URL to check: http://www.perlmonks.org http://www.perlmonks.org is good. C:\perl>perl linkcheck.pl URL to check: http://www.google.com http://www.google.com is good. C:\perl>perl linkcheck.pl URL to check: http://www.blahblahblah.com http://www.blahblahblah.com appears to be broken. C:\perl>
In reply to Re: Can You Explain How to Check a Link for Deadness
by DigitalKitty
in thread Can You Explain How to Check a Link for Deadness
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |