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


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

When you run your program, just specify the filename as an argument on the command line:
./program.pl file1.txt <optionally more files>
The filenames can then be found inside the script in the global array @ARGV.
  • Comment on Re: how can I input different files as an argument while I am running my perl program?
  • Download Code

Replies are listed 'Best First'.
RE: Re: how can I input different files as an argument while I am running my perl program?
by Anonymous Monk on Jul 12, 2000 at 01:01 UTC
    Thanks very much for the reply. However, does that mean that in my perl program, I should include the following line: open (INFILE, @ARGV); in order for me to input different textfiles when I type in the command line? btw is it necessary for me to include -x when I specify the path?