use warnings; use strict; use XML::Twig; my $t= XML::Twig->new( pretty_print => 'indented', twig_handlers => { '_all_' => sub {print $_->text,"\n"} }, #or print $_->text," " as ypu prefer ); $/=''; $t->parse(); __DATA__ 2014-01-10-07:59:24.439+05:30I----- 0 authn 101 0 PosIntWebSeal1prod goldytelecom uid=GOLDYTELECOM,cn=external,cn=Users,o=vodafone,c=in05262372-799f-11e3-96d8-00145ee78c6d 10.77.50.58IPV4 formsPassword