2 possibilities come to my mind at the moment:
If the file paths are not too long, you can pass them as additional parameters to system:
# master my @files = qw[ path/to/file0 path/to/file1 path/to/file2 ]; system 'perl', 'slave.pl', @files;
# slave print "List of files to process:\n"; print " $_\n" for (@ARGV);
If the paths are too long to pass them all as parameters, write them to a file, 1 per line:
# master my @files = qw[ path/to/file0 path/to/file1 path/to/file2 ]; open my $fh, '>', 'filelist'; print $fh, "$_\n" for (@files); close $fh; system 'perl', 'slave.pl'
# slave open my $fh, '<', 'filelist'; print "List of files to process:\n"; print while <$fh>; close $fh;
In reply to Re^3: How to pass file paths in a master script which is used to run several perl scripts?
by RonW
in thread How to pass file paths in a master script which is used to run several perl scripts?
by ankit.tayal560
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |