Run perl script, with command-line options

Hello everyone,

I have a perl script which takes various command line options from user like :

test.pl -i <input_file> -o <output_file> -d <value> -c <value>

Now I have multiple input files in a directory:

<input_file_1>
<input_file_2>
<input_file_3>
<input_file_4>
.....
....
...
..
.

I am trying to run this perl script for all the input files, in a unix shell script. The problem I am facing is that the program is not able to find <output_file> in the directory (obviously because it is defined by user with -o option). It gives the following error:

IOError: [Errno 2] No such file or directory: <output_file> 

Any suggestions?

You haven't posted your code so I can't see what's wrong with it. You'd like it to create the file, not just open it, right?

yes, I would like to create an output file. My code is as follows :

for i in $(ls test/*.input)
do
        new = ${i%%.input}
        test.pl -i $new.input.xml -o output_$new -x $new.info -d 86
done

$new.input.xml ---> Input files in my directory.
$new.info ----> corresponding info file for each input file.
-o output_$new ---> should return output file for each input file.

Have a look at

perldoc Getopt::Long

Your perl script has become shell scripting + python. Who's calling the which with the what now?

Sorry, its test.pl !

Okay. You still need to post the content of the perl script then.