How can I allow undefined options when parsing args with Getopt
If I have a command line like: my_script.pl -foo -WHATEVER My script knows about --foo , and I want Getopt to set variable $opt_foo , but I don't know anything about -WHATEVER . How can I tell Getopt to parse out the options that I've told it about, and then get the rest of the arguments in a string variable or a list? An example: use strict; use warnings; use Getopt::Long; my $foo; GetOptions('foo' => \$foo); print 'remaining options: ', @ARGV; Then, issuing perl getopttest.pl -foo -WHATEVER gives Unknown option: whatever remaining options: You need to configure "pass_through" option via