in reply to Using a 'getopt' in module code
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Using a 'getopt' in module code
by calin (Deacon) on Dec 04, 2006 at 20:55 UTC |