Re: uninitialized value
"stu meacham" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.lwp |
|---|---|
| Message-ID | <[email protected]> |
> ----- Original Message ----- > From: "Andy Lester" <[email protected]> > To: "stu meacham" <[email protected]> > Subject: Re: uninitialized value > Date: Sun, 19 Mar 2006 12:14:33 -0600 > > > > On Mar 19, 2006, at 11:43 AM, stu meacham wrote: > > > When I use HTML::TreeBuilder I get this: > > > > Use of uninitialized value in subroutine entry at > > /Library/Perl/5.8.6/HTML/TreeBuilder.pm line 94. > > > > What would be the easiest way to fix this? Thanx. > > > Need to know what your code and data look like. > > > -- > use strict; use LWP::Simple; use HTML::TreeBuilder; my $html = get("http://wwww.oreilly.com/"); my $root = HTML::TreeBuilder->new_from_content(\$html); my %images; foreach my $node ($root->find_by_tag_name('img')) { $images{ $node->attr('src') }++; } foreach my $pic (sort keys %images) { print "$pic\n"; } The code is from Sean Burke's 'Perl & LWP' page 13. I get a similar error message when I run the other short code on the same page of his book using HTML::TokeParser. The differences in the error message are the pm and the line number. -- _______________________________________________ Search for businesses by name, location, or phone number. -Lycos Yellow Pages http://r.lycos.com/r/yp_emailfooter/http://yellowpages.lycos.com/default.asp?SRC=lycos10