I would like to read multiple XML files in an array and then parse them one by one.
Here is what I am doing:
my $output = "c:\documents\outputfiles";
opendir (FILE, $output) or die "can't open the $output";
my @files = readdir File;
print @files;
This will list all the files under “outputfiles” directory. How do I just read the XML files?
I also tried:
my @files = grep {*.xml} readdir FILE;
This does not work.
Grep takes either an expression or a block as its first parameter. Also consider using
autodie: