Syntactic Confectionery Delight | |
PerlMonks |
Re: Convert arrayref to AoHby Athanasius (Archbishop) |
on Sep 20, 2014 at 14:21 UTC ( [id://1101393]=note: print w/replies, xml ) | Need Help?? |
Hello neilwatson, If your data is really always in the form shown, then, as Laurent_R says, you can simplify your data structure to a plain hash and overwrite default values easily:
Output:
But if (as I suspect) you really do need the more complex AoH, you can still make the overwriting code more efficient by breaking out of the inner loop when a match is found:
Hope that helps,
In Section
Seekers of Perl Wisdom
|
|