use strict; use warnings; use XML::Twig; my $FileResult = 'result.txt'; open( my $FhResult, '>', $FileResult ) or die("Unable to open file $FileResult\n$!"); my $twig1= XML::Twig->new( twig_handlers => { 'Parameter' => sub { $, = ","; print $FhResult $_->{'att'}->{'name'}. $, } } ); print $FhResult( (split('_', "d100spuptl25e0_datei1.xml",2))[0] . ',' ); $twig1->parsefile("d100spuptl25e0_datei1.xml");