
sonderkar
New User
Apr 13, 2010, 1:35 AM
Post #1 of 3
(3752 views)
|
Getopt::Std options paring problems in windows
|
Can't Post
|
|
Hi, 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"); getopts('i: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; $Linecount++; print fhOUT "$line\n"; last if $Linecount == $MaxLinecount; } close(fhIN); close(fhOUT); |