in reply to Re: How to pass a file to GetOpt
in thread How to pass a file to GetOpt

Sorry, forgot to clarify, I am using Windows command prompt. I am looking for how to do this in the code. For example:

while ($input){

Only that doesn't work.

Replies are listed 'Best First'.
Re^3: How to pass a file to GetOpt
by onelesd (Pilgrim) on Jul 10, 2012 at 22:09 UTC

    # usage: # script.pl /path/to/infile /path/to/outfile die "infile not defined\n" if (! defined $ARGV[0]) ; die "outfile not defined\n" if (! defined $ARGV[1]) ; open my $infile, "< $ARGV[0]" or die "can't read $ARGV[0]\n" ; open my $outfile, "> $ARGV[1]" or die "can't write $ARGV[1]\n" ; while (<$infile>) { chomp ; print $outfile "=>$_<\n" ; }