#!/usr/bin/perl use strict; use warnings; use XML::Twig; use Data::Dumper; my $content = do{ local $/; }; my $twig = new XML::Twig( twig_handlers => { 'NatuerlichePerson' => \&getPerson,} ); $twig->parse( $content ); sub getPerson{ my( $twig, $pers)= @_; my $child = $pers->first_child( 'geburtsdatum' ); #$child->cut_children; my $text = join '', map { $_->text if( $_->is_text || (exists $_->{'ent'})) } $child->children; print $text; } __DATA__ 19.05.1949 <_index cx:dt="int">6