It depends. How do you find all those files? If you have them in a text file, read them from that text file:
use strict; my $filename = 'my_textfile.txt'; open my $fh, $filename or die "Couldn't read '$filename': $!"; chomp @ARGV = <$fh>; print "Processing $_" for @ARGV;
If they all are below a certain directory, use File::Find:
use strict; use File::Find; my $directory = '/home/kelder/files'; find(sub { push @ARGV, $File::Find::name; }, $directory ); print "Processing $_" for @ARGV;
If you want to use a shell glob pattern, you can prevent the shell from expanding it and do the expansion in Perl:
use strict; use File::DosGlob qw(bsd_glob); # to get sane whitespace semantics my $pattern = '/home/kelder/files/*.txt'; @ARGV = glob $pattern; print "Processing $_" for @ARGV;
If you have the list in some other fashion, you'll have to tell us, but the basic pattern remains.
In reply to Re: Multiple file input into a perl script
by Corion
in thread Multiple file input into a perl script
by kelder
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |