on that note, you can also use the getopt module, that lets you specify
switches like you're used to on any linux system as follows:

script.pl -i input.txt -o output.txt

look at perldoc getopt for a simple description

regards,
Jos Boumans

"Brett W. McCoy" wrote:

> On Thu, 21 Jun 2001, Pedro A Reche Gallardo wrote:
>
> > I am writing a program that creates a file and write some data into it
> > using the usual
> > open (OUT, ">filename") or die "can't open file '$file'\n"; way
> >
> > but, how can I make the program to create a file with a name that is
> > given as one of
> > the program inputs?
> >
> > In other words if I execute the program as it follows:
> >
> > program.pl input1 input2 filename.out
> >
> > program.pl should use take  input1 and input2, do the job, and write the
> > data to a new file named   "filename.out".
>
> All of the arguments to your program go into an array @ARGV.  You need
> only to get the args out of there.  $0, BTW, holds the program name used
> on the command-line.
>
> -- Brett
>                                    http://www.chapelperilous.net/btfwk/
> ------------------------------------------------------------------------
> Oh wearisome condition of humanity!
> Born under one law, to another bound.
>                 -- Fulke Greville, Lord Brooke

Reply via email to