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.
In reply to Re: Parsing an Array of Hashes, Modifying Key/Value Pairs
by hdb
in thread Parsing an Array of Hashes, Modifying Key/Value Pairs
by librarat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |