To quote the HTML::Element documentation:
In list context, returns a list of elements at or under $h that have any of the specified tag names. In scalar context, returns the first (in pre-order traversal of the tree) such element found, or undef if none.
So, likely, the following code finds no element:
@stocks[$i]->find('a');
Maybe you want the following code?
my $stock_url = @stocks[$i]->find('a') or die "Couldn't find a link in " . @stocks[$i]->as_HTML;
As an aside, you better write it as
$stocks[$i]->find('a');
which Perl would also recommend, if you were running with warnings enabled.
In reply to Re: Why $stock_url->as_HTML report can't call method as_HTML ?
by Corion
in thread Why $stock_url->as_HTML report can't call method as_HTML ?
by attonie
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |