When i run my script like so:
C:\>perl script.pl -f file
It works fine. But, if I just do:
C:\>script.pl -f file
then I don't get any errors but getopts
doesn't assign anything to $opt_f
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 perl
installed (its a new OS build).
Code:
use Getopt::Std;
our ($opt_f);
getopts('f:');
print "input file is: $opt_f \n";
print "$0\n
Run with:
C:\> perl get.pl -f sadf
input file is: sadf
get.pl
Run without:
C:\>get.pl -f sadf
input file is:
Nothing!
EDIT: fixed and this question was a repeat... http://stackoverflow.com/questions/1695188/how-do-i-make-perl-scripts-recognize-parameters-in-the-win32-cmd-console
The OP of that post figured it out.
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.)