[ 'S', # indicates a start tag 'a', # this is an anchor tag $attr, # hashref to tag attributes, incl. "Onclick:" => "javascript code" $attrseq, # array ref to ordered list of %$attr. keys 'full text of anchor tag' ] #### my $htm = HTML::TokeParser->new( \$your_html_page ); while ( my $tkn = $htm->get_token ) { if ( $$tkn[0] eq 'S' and $$tkn[1] eq 'a' and $$tkn[2]{onclick} =~ /^javascript/ ) { my ( $url ) = ( $$tkn[2]{onclick} =~ /\("(http:.*?)"\)/ ); $url =~ s/\\u([0-9a-f]{4})/chr(hex($1))/ge; # do something with $url; } else { # do other stuff with other parts of html data... } }