S
Shan
My code works but only for the first line in a file. The file that is
being read contains urls.
for example
http://21stcmb.typepad.com
http://3banklawyers.typepad.com
I would appreciate your help getting my code to be fully functional.
Thank you
My code is below
---------------------------------------------------------------------------------------------------------------------------
#!/usr/bin/perl -w
use strict;
use LWP::Simple;
my $record;
my $entry;
open (OUT,">results.txt") or die "err";
open (URLS, "urls1.txt");
while ($record = <URLS>) {
$entry=$record;
my $html = get("$entry")
or die "Could not get the information you wanted";
while ($html =~ m{<link rel="alternate"(.*?) />}g){
my $site_feed = $1;
my $string = $site_feed;
my $ATTRIBUTE = qr/type|title|href/;
my $INSIDE_QUOTES = qr/.*?/;
my @files = $string =~ m{(?:$ATTRIBUTE)="($INSIDE_QUOTES)"}g;
print "Found @files\n";
print OUT "$entry \, $files[0] \, $files[1] \, $files[2]\n";
}
}
close (URLS);
--------------------------------------------------------------------------------------------------------------------
being read contains urls.
for example
http://21stcmb.typepad.com
http://3banklawyers.typepad.com
I would appreciate your help getting my code to be fully functional.
Thank you
My code is below
---------------------------------------------------------------------------------------------------------------------------
#!/usr/bin/perl -w
use strict;
use LWP::Simple;
my $record;
my $entry;
open (OUT,">results.txt") or die "err";
open (URLS, "urls1.txt");
while ($record = <URLS>) {
$entry=$record;
my $html = get("$entry")
or die "Could not get the information you wanted";
while ($html =~ m{<link rel="alternate"(.*?) />}g){
my $site_feed = $1;
my $string = $site_feed;
my $ATTRIBUTE = qr/type|title|href/;
my $INSIDE_QUOTES = qr/.*?/;
my @files = $string =~ m{(?:$ATTRIBUTE)="($INSIDE_QUOTES)"}g;
print "Found @files\n";
print OUT "$entry \, $files[0] \, $files[1] \, $files[2]\n";
}
}
close (URLS);
--------------------------------------------------------------------------------------------------------------------