title: How can I allow undefined options when parsing args with Getopt
body: <p>If I have a command line like:</p>
  
  <pre><code>my_script.pl -foo -WHATEVER
  </code></pre>
  
  <p>My script knows about <code>--foo</code>, and I want Getopt to set variable <code>$opt_foo</code>, but I don't know anything about <code>-WHATEVER</code>.  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?</p>
  
  <p>An example:</p>
  
  <pre><code>use strict;
  use warnings;
  
  use Getopt::Long;
  
  my $foo; 
  
  GetOptions('foo' =&gt; \$foo); 
  
  print 'remaining options: ', @ARGV;
  </code></pre>
  
  <p>Then, issuing </p>
  
  <pre>perl getopttest.pl -foo -WHATEVER</pre>
  
  <p>gives</p>
  
  <pre>
  Unknown option: whatever
  remaining options:
  </pre>