in reply to Re^2: GetOpts not working:
in thread GetOpts not working:
There appears to be no benefit to your use of a for loop in that code. Standard hash population means that it isn't needed.
use strict; use warnings; my @ARGV = qw(-infile data_in.bin -outfile data_out.bin); my %args = @ARGV; print "Infile: $args{-infile}\n", "Outfile: $args{-outfile}" if ( exis +ts $args{-infile} && exists $args{-outfile} );
works just the same. HTH.
PS. I wouldn't use @ARGV for a lexical variable name since it ordinarily has a special meaning.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: GetOpts not working:
by james28909 (Deacon) on Dec 10, 2015 at 15:36 UTC | |
by hippo (Archbishop) on Dec 10, 2015 at 16:08 UTC | |
by james28909 (Deacon) on Dec 10, 2015 at 16:30 UTC |