in reply to Newbie XML Simple reference

XML::Twig is nice too:
use strict; use warnings; use XML::Twig; my $xfile = <<EOF; <SUB CLASSNAME="SUB1"> <INNERSUB CLASSNAME="INNERSUB1"> <Element1 Type="Type1">Content</Element1> <Element2 Type="Type2">Content</Element2> </INNERSUB> </SUB> EOF my $t= new XML::Twig(); $t->parse($xfile); my $sub = $t->root(); for my $elm ($sub->first_child('INNERSUB')->children()) { print $elm->name(), "\n"; print $elm->att('Type'), "\n"; print $elm->text(), "\n\n"; } __END__ Element1 Type1 Content Element2 Type2 Content

Note: I had to modify your "element" end tags to be "Element", for legal XML.