PKV has asked for the wisdom of the Perl Monks concerning the following question:
I am using Getopt function to open 2 separate files with different extensions (.txt and .aspx) in my Perl script by passing single command line argument.
Now, there are many such files of both kinds located in separate folders under the same directory. (Many .txt's in folder text. Same number of .aspx's in folder excel. Folders text and excel are under same directory /pkv/kbv/skv/).
I need to open these files one pair at a time and process them. Then repeat same for remaining pairs (any number). Can I do this by passing command line arguments for the "directory" and "files list"?
use Getopt::Long qw(GetOptions); GetOptions('in=s') or die; $txt = $opt_in . ".txt"; $aspx = $opt_in . ".tab" . ".aspx"; open (TXT, "< $txt") || die; ... close(TXT) open (ASPX, "< $aspx") || die; ... close(ASPX)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Passing multiple input files to a Perl script through command line
by shmem (Chancellor) on Jun 06, 2018 at 17:48 UTC | |
|
Re: Passing multiple input files to a Perl script through command line
by thanos1983 (Parson) on Jun 06, 2018 at 19:19 UTC |