in reply to Re^4: GetOpts not working:
in thread GetOpts not working:
Does it somehow auto assign a key/value pair?
Essentially, yes. When you assign directly to a hash it expects a list of key-value pairs. This is why you sometimes see the warning "Odd number of elements in hash assignment" because the list must be even-sized so that each key has a corresponding value. These two assignments are effectively the same:
my %foo = ( baz => 1, frob => 'quux' ); my %bar = ( 'baz', 1, 'frob', 'quux' );
There's more about this in List value constructors in perldoc.
Does that help?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: GetOpts not working:
by james28909 (Deacon) on Dec 10, 2015 at 16:30 UTC |