When I run it it says: Useless use of substr in void context at newcrawler.pl line 23. I think that it is getting trapped in my if statements, which are meant to deal with links like /foo/foo.htm and foo.htm Any ideas, 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"); while(<LINKS>) { 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; foreach $links (@links) { if($links=~m/^\// and $_=~m/\/$/) { substr($links, 0, 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; }
20040220 Edit by BazB: Changed title from 'Web Crawler'
In reply to Useless use of substr in void context by mkurtis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |