Hi All,

Can someone please point me in the right direction... maybe a module..?  

I have a file that contains the file name and the url.  I need to separate
the url so I can use LWP::Simple; to check the link, however, I need to keep
the file name in tact so I can trace it back to my website.  Anyone have any
suggestions?

Thanks for your help.  

Below is what I am using to check the links. 

#!/usr/local/bin/perl -w

use strict;
use LWP::Simple;

my $file = "/Program Files/OptiPerl/results.txt";
        open (LINKS, $file) or die "Can't open $file: $!";

# ------------ slurp the file -------------------------
my @urls = <LINKS>;
# ----------- remove line endings ---------------------
chomp @urls;
# --------- check each url in file --------------------
foreach my $url (@urls)
  {
        print "$url\n";
        my ($type) = head($url);
# ---------- broken links go into bad.txt -------------
        unless (defined $type) {
    open (BAD, ">>bad.txt");
    print (BAD "$url\n");
#   print "Couldn't get $url\n";
    next;
    }
# --------- good links go into good.txt ---------------
    if ($type) {
    open (GOOD, ">>good.txt");
    print (GOOD "$url\n");
#       print "Got it! \n$url\n";
    }
  }
# --------- close all file handles --------------------
close LINKS;
close GOOD;
close BAD;

Brian Volk



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to