Thanks for your help! As you can probably tell, I'm learning as I go and certainly appreciating the more than one way to do things in Perl. I think what I'm more interested in is actually the best way to do it. Appreciate you've called out the method is messy, and I have to agree. Could I ask possibly how you would do it please?

Good question! It rather depends on the properties of your data and how you want it structured. I guess that each "service-name" is unique? You could then have a much flatter data structure if you just keyed on that. eg:

results

service name

dns

static

next hop

tag

But maybe that's no use to you depending on how you would want to use the data later on. Once you know what most useful form the data should take you can go about constructing it (and that might even involve some pre-processing).