in reply to Why $stock_url->as_HTML report can't call method as_HTML ?
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
| A reply falls below the community's threshold of quality. You may see it by logging in. |