Getopt works on @ARGV, so you can't use it to process function arguments. Well, not without doing @ARGV = @_ which might well break other stuff.
In situations like this, most people would probably pass the function arguments as a hash.
my_func(foo => 1, bar => 2); sub my_func { my %args = @_; if ($args{foo}) { ... } # etc... }
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
In reply to Re: Using a 'getopt' in module code
by davorg
in thread Using a 'getopt' in module code
by throop
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |