in reply to XML twig question

My guess is you want children which returns an array.

for my $subclass ($offer->children('subClassOf')) { print "is subclass of " . $subclass->att('resource') . "\n"; }
That way you have all of them. Of course, children could return an empty list, which means the print statement wouldn't get executed, but that's probably what you want anyway.

Perl is great for this: rather than doing it the non-idiomatic way you're trying where you go and look for first_child twice, I look for all children at a time and simply loop through them. Chances are, this is exactly what I want: skip the loop if there's nothing, but do everything on each item in the list if there is something.

Hope that helps.