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.
In reply to Re^3: GetOpts not working:
by hippo
in thread GetOpts not working:
by finfan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |