use strict; use XML::XPath; my $xp = XML::XPath->new(filename => "xmlexample.xml"); my $oldemail= $xp->findvalue('/transactionUpdate/transaction/customerEmails'); $oldemail =~ s/\s//g; # Get rid of whitespace print $oldemail,"\n";