I am trying to use TreeBuilder to get all of the strings in a certain tag of an HTML document into an array. I use find('mytag') which works fine to get all of the elements, but if I just print the array created from that then it prints HTML::Element hashes instead of the strings. That makes sense considering HTML::Element has the command "as_text". When I try to use "as_text" in the following way:
my @parsed = $element -> find('tag');
then it will only print the first instance of text within the desired tag instead of all of them. If I try and use "as_text" on @parsed in the following way:
my @parsed = $element -> find('b');
@parsed -> as_text();
then I get a "Can't call method 'as_text' without package..." error. Is there a specific syntax for doing this that I just am not getting?