for ( $xp->findnodes('/application_list/application/@id') ){ my $id = $_->string_value; $id =~ s/^\s+|\s+$//g; push @records, { appid => $id }; };