in reply to Using a 'getopt' in module code
Aside from the fact that getopts is going to try and read from @ARGV and not @_, the usual means of getting keyword-y arguments for subroutines is to use @_ to initialize a hash.
sub blortz { my @defaults = qw( foo 1 baz 42 ); my %args = ( @defaults, @_ ); print "baz is the answer\n" if $args{baz} == 42; } blortz( baz => 2.71828 );
|
|---|