lampros21_7 has asked for the wisdom of the Perl Monks concerning the following question:
#Create an instance of the webcrawler my $webcrawler = WWW::Mechanize->new(); my $url_name = <STDIN>; # The user inputs the URL to be searched my $uri = URI->new($url_name); # Process the URL and make it a URI #Grab the contents of the URL given by the user $webcrawler->get($uri); #Use the HTML::TokeParser module to extract the contents from the web +site my @stripped_html; my $x = 0; my $content = $webcrawler->content; my $parser = HTML::TokeParser->new(\$content); while($parser->get_tag){ $stripped_html[0] = $parser->get_trimmed_text(),"\n"; print $stripped_html[0]; } exit;
Here i have left the print $stripped_html[0]; and it works. If i take that command outside the loop it wont print anything.Any ideas?Thanks in advance
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: My array element won't print outside a loop
by broquaint (Abbot) on Aug 09, 2005 at 10:58 UTC | |
|
Re: My array element won't print outside a loop
by GrandFather (Saint) on Aug 09, 2005 at 11:04 UTC | |
by lampros21_7 (Scribe) on Aug 09, 2005 at 14:32 UTC | |
by GrandFather (Saint) on Aug 09, 2005 at 18:34 UTC |