I'm a newbie to Perl. I have a site with various external URLs in a flat-file database. If I have the URL in a variable in my program, what would I have to do to check the URL to see if it's dead or not?
I read through other similar questions. I didn't get it. One, I'm not sure if I have LWP. Two, I just didn't get it.
The best I found was this:
print $s "GET ".($2||'/')." HTTP/1.0\nHost: $1 \n\n";
print "Link $_ is validated\n" if <$s>=~/200 OK/;
However, I'm clueless as to why it's a for. Also, it looks like it's reading from a default variable and I don't know how to set that.
Could anyone explain either what this code is doing (line by line) or give me a better snippet of code? I don't need something that checks many links, just one.