I tried your code and got it to work by inserting a "chomp;" in your while loop. I
don't understand chomp/chop well enough to figure out how to imbed it within the print
line, though. Give it a shot if you think it will run faster that way.
-- Brad
----- Original Message -----
From: "Drew Cohan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 21, 2001 3:52 AM
Subject: fastest method to check if a URL is alive
> Hi,
>
> Could some kind soul please tell me why the following
> prints nothing for valid URLs? I'm trying to write a
> small, tight, and very fast script that'll check to
> see if a URL is alive in the least amount of time
> possible (and avoid using PING). I need to check
> thousands of URLs. It seems to me that this should be
> a relatively simple affair? Below is some code I've
> tried to adapt from the cookbook (example 20.1). I
> was also intrigued by the HTML:Status class mentioned
> in the perldoc, but I can't seem to figure out how to
> use it without employing the seemingly overkill
> LWP:UserAgent.
>
> thanks in advance,
>
> Drew.
>
> ---- snip ----
> #!/usr/bin/perl -w
>
> $|++;
>
> use warnings;
> use strict;
> use diagnostics;
>
> use LWP::Simple;
>
> while (<>){
> print if (defined (my $content = get $_));
> }
> ---- end of snip ----
>
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.com/