Home: Perl Programming Help: Advanced:
Getopt::Std options paring problems in windows

New User

Apr 13, 2010, 1:35 AM

Views: 4010
Getopt::Std options paring problems in windows

I have A LOT of scripts, and I'm now trying to put them all in 1 directory on a windows 64 bit machine, at put this directory in the system PATH variable, so the scripts can be executed from the command line without the script having to be in the same directory. Most if working fine, but I have some where I use the
Getopt::Std option.
These options are not parsed. these are parsed using Linux

Does anybody know a fix to this for windows?

use strict;
use Getopt::Std;
use vars (qw " $opt_i $opt_l");

print "Usage:\n-i inputfile\n-l Number of lines in small file\n" unless @ARGV;
exit unless @ARGV;

my $Inputfile = $opt_i;
my $MaxLinecount = $opt_l ? $opt_l: 1000;
my $Outputfile = "Small-".$Inputfile;
my $Linecount = 0;
print "$MaxLinecount\n";

open( fhIN, "$Inputfile" || die "Can't open $Inputfile" );
open( fhOUT, ">$Outputfile" || die "Can't open $Outputfile" );
while (<fhIN>) {

my $line = $_;
chomp $line;
print fhOUT "$line\n";
last if $Linecount == $MaxLinecount;




Veteran / Moderator

Apr 13, 2010, 5:07 AM

Views: 4005
Re: [sonderkar] Getopt::Std options paring problems in windows

Sounds like your .PL file type association is not setup correctly.

The action attribute needs to be set like this (adjust the path as needed):

"C:\Perl\bin\perl.exe" "%1" %*

New User

Apr 13, 2010, 6:25 AM

Views: 4002
Re: [FishMonger] Getopt::Std options paring problems in windows

I believe you could be right,
i looked an it seems that this is already set with the%*

I found a thread where people had the same problem:


BUT I made it work. Can't explain it, but using windows powershell it works Smile