It's untested.#! /usr/bin/perl use strict; use warnings; use HTML::Parser; my $string = qq~.:<script>text</script> .:<script>text34</script> <div + class="bbcode">sammler schrieb:</div><a href="http//url.tld">test</a +>~; my $p = HTML::Parser->new(); $p->handler(start => \&start_handler,"tagname,attr,self"); $p->parse($string); sub start_handler{ return if(shift ne 'a'); print shift->{href}; my $self = shift; my $text; $self->handler(text => sub{$text = shift;},"dtext"); $self->handler(end => sub{print $text,"\n\n" if(shift eq 'a')},"tagn +ame"); }
In reply to Re: parse out anchor text
by reneeb
in thread parse out anchor text
by tsu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |