that array idea sounds good, but how musch memory would that take up? Does anyone know how i could do it using files? Obviously this isnt going to be a huge webcrawling expedition, but it could end up with 100,000 sites in its array if it hits a very linkish site a couple times. Thanks#!/usr/bin/perl -w use LWP::Simple; use HTML::SimpleLinkExtor; use Data::Dumper; use LWP::RobotUA; use HTTP::Response; open(LINKS,">>/home/baelnorn/urls.txt") || die "$!"; while(<LINKS>) { print"hello"; chomp $_; my $ua = LWP::RobotUA->new("theusefulbot", "akurtis3 at yahoo.com" +); $ua->delay(10/60); my $content= $ua->get($_); my $extor = HTML::SimpleLinkExtor->new(); $extor->parse($content); my @links=$extor->a; print "start"; foreach $links (@links) { if($links=~m/^\// and $_=~m/\/$/) { substr($links, 0, 1) = undef; print "1"; my $address="$_ $links"; print LINKS "$address\n"; } else { if($links=~m/^http:\/\/|^www./) { print LINKS "$links\n"; } if($links != ~m/^\// and $_=~m/\/$/) { my $address="$_ $links"; print LINKS "$address\n"; } if($links != ~m/^\// and $_ != ~m/\/$/) { my $address="$_ \ $links"; print LINKS "$address\n"; } } } print $content; } close(LINKS);
In reply to Re: Re: Useless use of substr in void context
by mkurtis
in thread Useless use of substr in void context
by mkurtis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |