in reply to Parsing @ARGV w/ Map Function

I'm just wondering if there's enough flexibility to do all this, and do it without going through @ARGV multiple times.logic

Yes, there is enough flexibility to do this without going through @ARGV multiple times; map is just a glorified foreach :) This is how you start

#!/usr/bin/perl -- use strict; use warnings; use Test::More qw' no_plan '; Main( @ARGV ); exit( 0 ); sub Main { my @arg = ( [ [ '--foo=bar', '--foo', 'bar' ], undef, {foo => 'bar' } ], [ [ '--foo', 'bar' ], undef, {foo => 'bar' } ], [ [ '--one=two', '--foo', 'bar' ], undef, {one => 'two', foo = +> 'bar' } ], ); for my $arg( @arg ){ my( $in, $spec, $expected ) = @$arg; my $got = MapArg($in,$spec); is_deeply($got, $expected , "( @$in )" ); } } sub MapArg { my( $arg, $spec ) = @_; my %res = map {/^--(.*?)=/ => /=(.*)$/} @$arg; return \%res; } __END__ # Failed test '( --foo bar )' # at - line 20. # Structures begin differing at: # $got->{foo} = Does not exist # $expected->{foo} = 'bar' # Failed test '( --one=two --foo bar )' # at - line 20. # Structures begin differing at: # $got->{foo} = Does not exist # $expected->{foo} = 'bar' # Looks like you failed 2 tests of 3.
You'll have to decide the rules, what combination of inputs produces what outputs (think in terms of edge cases), using what $spec (if any).