in reply to how can I input different files as an argument while I am running my perl program?

As plaid said, just add the filename(s) as arguments (space delimited) after the program name.

Example:

program.pl file1 file2 file3

The array @ARGV contains the command line arguments intended for the program. To get the filename or filenames you simply get it from your @ARGV array as follows:

my $file = shift(@ARGV); # for one file
or
my @files = @ARGV; # for more than one file
You can then do whatever you need to with the file names.
  • Comment on Re: how can I input different files as an argument while I am running my perl program?
  • Select or Download Code