hello all,
I am trying out the getopt::long perl module and i have a small problem with it
Code:
#!/usr/bin/perl
use strict
use Getopt::Long;
my $data =;
my $length=;
my $verbose;
$result = GetOptions ("length=s" => \$length, # numeric
"file=s" => \$data, # string
"verbose" => \$verbose); # flag
print "$length,$file";
The problem is when i give the arguments as
Code:
./test --length --file "hello.txt"
Where the argument for --length is omitted,the value of variable length becomes --file
,is there anyway i can stop this from happening?
I need to implement optlong in one of my code,and if the user forgets to give a value for an option,i dont want the next option to become its value
. thanks