http://qs321.pair.com?node_id=1190958


in reply to Wildcards for a wide array of strings?

For 'THE PROBLEM' you might want to consider using a loop, with a regex test for the files you want - a suggestion that infers from your text that the $from directory may contain non-.txt files.

#!/usr/bin/perl -w use strict; # 1190936 my @sourcefiles = <DATA>; for $_(@sourcefiles) { if ($_ =~ /.+?\.txt/ ) { # process it here -- simulated by; print $_; } else { next; } } __DATA__ foo.bar bar.txt baz.bat blivitz.txt; nottext and somethingelse.txt

Rewriting LN 5 to obtain data from your source directory is left as a (trivial) exercise -- once you do some reading, using perldoc open, for example.

execution:

C:\1190936.pl bar.txt blivitz.txt; somethingelse.txt