hi,
I'm trying to print out the href attribute of all links in a document but not succeeding for some reason. I keep getting the error:
Can't use string ("</a>")as a HASH ref while strict refs in useIt's probably some stupid mistake but I'm new to HTML::TokeParser and perl so bear with me. The code is:
#! c:\perl\bin -w use strict; use HTML::TokeParser; my $p = HTML::TokeParser->new(shift||die); while (my $token = $p->get_token) { print $token->[2]{'href'}, "\n" if ($token->[1] eq 'a'); }
And the relevant part of the html is:
<td nowrap> <font size="-1"><a href="/home.cfm" target="_top" class=" +novisit">Home</a> | <a href="/SpecimenSearch.cfm" target="_top" clas +s="novisit">Specimen Search</a>
-----------------------------------
Any comments about coding style are welcome.In reply to HTML::Tokeparser and $attr problem by dannoura
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |