hello,
I use getopt in my script
my code
with getopt if i call my script like this
myscript.pl -f input.txt
my script run
but if i call my script like this
myscript.pl
or like this
myscript.pl -f
it must not run
and getopt show an error,if i good understand this module;
But my script run with the 2 last case, and i don't understand why ?
Thanks
I use getopt in my script
my code
Code:
use strict;
use warnings;
use Getopt::Long;
###############################################################################
my $file = 0;
my $result = GetOptions(
"file=s" => \$file
);
if ( $result == 0 ) { exit 1; }
with getopt if i call my script like this
myscript.pl -f input.txt
my script run
but if i call my script like this
myscript.pl
or like this
myscript.pl -f
it must not run
and getopt show an error,if i good understand this module;
But my script run with the 2 last case, and i don't understand why ?
Thanks