I am trying out the getopt::long perl module and i have a small problem with it
my $data =;
$result = GetOptions ("length=s" => \$length, # numeric
"file=s" => \$data, # string
"verbose" => \$verbose); # flag
The problem is when i give the arguments as
./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