in reply to Parsing an Array of Hashes, Modifying Key/Value Pairs
You could also more actively "keep" the desired fields.
sub loadFileToHashRef { my $xmlRef = $xml->XMLin($_[0]); # Clean our hash for my $textRef ( @{$xmlRef->{sms}} ) { %{$textRef} = map { $_ => $textRef->{$_} } @keysToKeep; } # Return our hash ref return $xmlRef; }
If they didn't exist in the XML, you will get some undefs.
|
|---|