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 );
In reply to Re: Using a 'getopt' in module code
by Fletch
in thread Using a 'getopt' in module code
by throop
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |