#! /usr/bin/perl use strict; use warnings; use HTML::Parser; my $string = qq~.: .:
sammler schrieb:
test~; 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')},"tagname"); }