in reply to Re: GetOpts not working:
in thread GetOpts not working:
I am growing to really like hashes, and I think im about ready to start doing like hash of arrays, so i can have multiple values for a single hash key. Isnt that how this works?use strict; use warnings; my @ARGV = qw(-infile data_in.bin -outfile data_out.bin); my %args; for ( 0 .. $#ARGV / 2 ) { my $switch = shift(@ARGV); my $value = shift(@ARGV); $args{$switch} = $value; } print "Infile: $args{-infile}\n", "Outfile: $args{-outfile}" if ( exis +ts $args{-infile} && exists $args{-outfile} );
I just wonder how i would print all the valuesmy %hash = { key => [value_1, value_2, value_3, value_4]};
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: GetOpts not working:
by hippo (Archbishop) on Dec 10, 2015 at 09:13 UTC | |
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 |