title: Why do I have to explicitly add perl before the script for getops to run properly?
body: <p>When i run my script like so: </p>
  
  <pre>C:\>perl script.pl -f file</pre>
  
  <p>It works fine. But, if I just do:</p>
  
  <pre>C:\>script.pl -f file</pre>
  
  <p>then I don't get any errors but <code>getopts</code> doesn't assign anything to <code>$opt_f</code></p>
  
  <p>This works just fine on perl 5.8 Windows XP, but it doesn't work on perl 5.12 on Windows 7.
  There aren't any other versions of <code>perl</code> installed (its a new OS build).</p>
  
  <h3>Code:</h3>
  
  <pre><code>use Getopt::Std;
  our ($opt_f);
  getopts('f:');
  print "input file is: $opt_f \n";
  print "$0\n
  </code></pre>
  
  <p>Run with:</p>
  
  <pre><code>C:\&gt; perl get.pl -f sadf
  input file is: sadf
  get.pl
  </code></pre>
  
  <p>Run without:</p>
  
  <pre><code>C:\&gt;get.pl -f sadf
  input file is:
  </code></pre>
  
  <p>Nothing!</p>
  
  <p>EDIT:  fixed and this question was a repeat...
  <a href="https://stackoverflow.com/questions/1695188/how-do-i-make-perl-scripts-recognize-parameters-in-the-win32-cmd-console">How do I make Perl scripts recognize parameters in the Win32 cmd console?</a></p>
  
  <p>The OP of that post figured it out.<br>
  I had to do the same but also recreate the assoc in the gui (in addition to in the reg and on the command line with ftype.)  </p>