in reply to xml::simple foreach

To get a better idea of what your data structure looks like you should use Data::Dump or Data::Dumper.
my $xmlfile = new XML::Simple (Outputfile => $conf, ForceArray => 1, RootName=>'exec'); my $xml = $xmlfile->XMLin($conf); use Data::Dump qw(dump); print "XML => " . dump( $xml );

This should be a good starting point to see what you are working with.