in reply to Getting the Linking Text from a page

You could do it using HTML::Parser, but I don't even wanna think about the logic (done it before, I stick to the simple things that work). Just use HTML::TokeParser (or even HTML::TokeParser::Easy), something like
#!/usr/bin/perl -w use strict; use HTML::TokeParser; my $p = new HTML::TokeParser($ARGV[0]) or die; while(my $t = $p->get_token()) { if($$t[0] eq 'S' and $$t[1] eq 'a') { print $$t[2]->{href}, "\n", $p->get_trimmed_text('/a'), "\n\n"; } } undef $p;

 
______crazyinsomniac_____________________________
Of all the things I've lost, I miss my mind the most.
perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;"

Replies are listed 'Best First'.
Re: (crazyinsomniac) Re: Getting the Linking Text from a page
by jonjacobmoon (Pilgrim) on Mar 13, 2002 at 10:35 UTC
    Thanks Crazy. That was it precisely. Totally forgot about HTML:;TokeParser. I feel stupid, but I am happy to be able to move onto the next problem.

    :)


    I admit it, I am Paco.