use XML::XPath; my $xp = XML::XPath->new(filename => 'greet.xml'); print $xp->findvalue('//greeting/text()')->value();