use strict; use warnings; use XML::XPath; my $xp = XML::XPath->new(filename => 'mdlist.xml'); my @mds = map { $_->getAttribute('name') } $xp->findnodes('/md_map/md[@name]'); for my $dir (@mds) { # create $dir if applicable } #### my $callout_loc = '/path/to/xml/stuff'; my $file = "$callout_loc/mdlist.xml"; #### mkdir $dir or warn "$dir already exists: $!";