in reply to Suggestion needed for automating 3 separate programs/components

Okay, I'm trying to find a Perl question in this post, and this is the closest thing I can find...

This is to be repeated till all .xml files in directory is exahausted.

Are you asking how to loop through all the .xml files in a directory? There's more than one way to do that, e.g., you could use glob or File::Find. If I were doing it, I'd probably use readdir. If you use glob or readdir, you can use grep to select only the files whose names end in .xml and run a foreach loop over the results, something like the following (untested):

opendir(MYDIR, $dirpathname) or die "Cannot open directory: $!"; foreach my $xmlfile (grep { -f $_ and /[.]xml$/ } readdir MYDIR) { do_stuff_with($xmlfile); } closedir MYDIR;

update: added filetest to prevent inadvertently treating a directory as an XML file if it happens to have a name ending in .xml

  • Comment on Re: Suggestion needed for automating 3 separate programs/components
  • Download Code