#!/usr/bin/perl -- use strict; use warnings; use XML::LibXML; Main(@ARGV); exit(0); sub Main { my $doc = XML::LibXML->load_xml( string => <<'__XML__'); __XML__ for my $nod ( $doc->findnodes('/root/child/text()') ) { print "$nod\n", $nod->string_value, "\n-----\n"; } } ## end sub Main __END__ XML::LibXML::Text=SCALAR(0xa12c14) ----- XML::LibXML::CDATASection=SCALAR(0xa983c4) Here's a bunch of fun text that I want to get a substring out of. ----- XML::LibXML::Text=SCALAR(0x9d75d4) -----