So far this is what I have come up with, and am a little stuck
#! perl\bin\perl
use strict;
use warnings;
use WWW::Mechanize;
my $mech = WWW::Mechanize->new();
open(FILE, "< file1.html") || print "Unable to open the file file1 \n";
while (<FILE>)
{
if($_ =~ /on\.fe/)
{
my $url = $_;
print $mech->uri."\n";
$mech->get($_);
$mech->content();
if($mech->content()=~ /www\.arax/)
{
my $url2 = $mech->content() =~ /www\.arax/;
print $mech->uri."\n";
s/$url/$url2/;
print;
}
}
}
close(FILE);
Hi,
I have never used WWW::Mechanize module, and I am a little confused by
your code
(could just be me).
The statement "my $url2 = $mech->content() =~ /www\.arax/;" is not
going to
set $url2 to a string if that was your intent. Since you already know
that the regular expression matches (the preceding 'if' statement),
$url2 is set to 1 (true) indicating there was a match.
Did you just want the following?
my $url2 = $mech->content();
Ken
Neither your prose nor your program give me a feel for what you're
trying to do. Can we see some sample data for both file1.html and one of
the "www\.arax" containing files?
--
paduille.4...@earthlink.net
http://home.earthlink.net/~mumia.w.18.spam/
From file1.html, a sample of the html code:
<li class="MsoNormal" style="line-height: 18.0pt; text-autospace:
ideograph-numeric ideograph-other; background: white">
<span style="font-size: 11.0pt; font-family: Tahoma">
<a href="http://...online.feeds.com/link1/" target="_blank" style="color:
blue; text-decoration: underline; text-underline: single">
<span style="color: #336699; text-decoration: none">Links
Part 2</span></a> </span></li>
<li class="MsoNormal" style="line-height: 18.0pt; text-autospace:
ideograph-numeric ideograph-other; background: white">
<span style="font-size: 11.0pt; font-family: Tahoma">
<a href="http://...online.feeds.com/link2/" target="_blank" style="color:
blue; text-decoration: underline; text-underline: single">
<span style="color: #336699; text-decoration: none">Links
Part 3</span></a> </span></li>
<li class="MsoNormal" style="line-height: 18.0pt; text-autospace:
ideograph-numeric ideograph-other; background: white">
<span style="font-size: 11.0pt; font-family: Tahoma">
<a href="http://...online.feeds.com/link3/" target="_blank" style="color:
blue; text-decoration: underline; text-underline: single">
<span style="color: #336699; text-decoration: none">Links
Part 4</span></a> </span></li>
<li class="MsoNormal" style="line-height: 18.0pt; text-autospace:
ideograph-numeric ideograph-other; background: white">
<span style="font-size: 11.0pt; font-family: Tahoma">
<a href="http://...online.feeds.com/link4/" target="_blank" style="color:
blue; text-decoration: underline; text-underline: single">
<span style="color: #336699; text-decoration: none">Links
Part 5</span></a> </span></li>
The contents of the link http://...online.feeds.com/link1/ for example is:
<body>
...
</td></tr><tr><td
style="height:81%;width:100%;padding:0;text-align:left;"><embed
src="http://...arax.../v/gomlckZfGYU..." </embed> </td>
</tr>
<tr>
<td style="height:13%;width:100%;padding:0;text-align:left;">
The guy is multi-posting.
http://www.thescripts.com/forum/thread580426.html
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl