#!/usr/bin/perl use strict; use warnings; use Data::Dumper; use local::lib 'lib1'; use SOAP::Lite; my $xml = q{ -910253925912285490 ContextId_1364228178892 Export_Device DeviceType='NAS' SELECT DISTINCT huge-ass sql statement cropped for clarity) ) ) ) ) ORDER BY 1 5000 0 152 0 }; my $som = SOAP::Deserializer->deserialize($xml); my $subsom = $som->match('/Envelope/Header/[1]'); my $res = $subsom->valueof(); print "Result: $res\n";