use XML::LibXML; $ARGV[0] || die; $path=$ARGV[0]; # open the designated directory opendir(DIR, $path); @files = grep(/\.xml$/,readdir(DIR));