http://www.perlmonks.org?node_id=1008781


in reply to Fetch field values from API output

A solution using XML::XSH2, a wrapper around XML::LibXML.
#!/usr/bin/perl use warnings; use strict; use feature qw(say); use XML::XSH2; @XML::XSH2::Map::accum_ids = (269, 270, 1962); xsh << '__XSH__'; open 1008484.xml ; for my $id in { @accum_ids } { cd /envelope/body/outputGetUsageSummary/usgSumm/usageAccum[@ac +cumId=$id] ; my $attrs = (@inclUnits | @inclUnitsUsed | @shared) ; perl { push @results, $attrs } ; } __XSH__ for my $result (@XML::XSH2::Map::results) { say join ' ', map $_->value, @$result; }
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ