Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

how do input two files and indicate an output file to a program as command line arguments? Thanks for any help

Replies are listed 'Best First'.
Re: file input from command line
by John M. Dlugosz (Monsignor) on Jul 10, 2001 at 06:39 UTC
    A quick and dirty answer: my ($in1, $in2, $out)= @ARGV;

    A more general-purpose answer: see Getopt::Long or other options modules.

Re: file input from command line
by Graham (Deacon) on Jul 10, 2001 at 12:56 UTC
    Further to John's answer, Getopt::Std may be of use to you. I pass options in as follows:
    use strict; use Getopt::Std; my $USAGE="USAGE: sample.pl -f <infile1> -i <infile2> -o <outfile>"; my %Options; getopts('f:i:o:', \%aOptions); my $infile1= $aOptions{f} || die "** $USAGE.\nERROR missing input file +1 ** "; my $infile2= $aOptions{i} || die "** $USAGE.\nERROR missing input file +2 ** "; my $outfile= $aOptions{o} || die "** $USAGE.\nERROR missing output fil +e ** ";