D
Davy
Hi all,
I have write a small program to test Getopt::Std.
I found when I enterit work OK: output: minus_result is -50
But when I enterIt output the help message?
Why -v must be write at the end of the argument list??
#-------------------------
use warnings;
use strict;
use Getopt::Std;
my $help = <<"EOH";
--------------------------------------------
$0: first_vector minus second_vector
Options:
-a first_vector
-b second_vector
-h print help
-v verbose
--------------------------------------------
EOH
# set out command-line options,
# requirements, and defaults.
my %options;
getopt("a:b:hv", \%options);
die $help if exists $options{h};
die $help unless $options{a};
die $help unless $options{b};
my $first_vector = $options{a};
my $second_vector = $options{b};
my $minus_result = $first_vector - $second_vector;
if (exists $options{v}) {
print "minus_result is $minus_result\n";
}
else {
print "$minus_result\n";
}
#-------------------------------------
Thanks!
Davy
I have write a small program to test Getopt::Std.
I found when I enterit work OK: output: minus_result is -50
But when I enterIt output the help message?
Why -v must be write at the end of the argument list??
#-------------------------
use warnings;
use strict;
use Getopt::Std;
my $help = <<"EOH";
--------------------------------------------
$0: first_vector minus second_vector
Options:
-a first_vector
-b second_vector
-h print help
-v verbose
--------------------------------------------
EOH
# set out command-line options,
# requirements, and defaults.
my %options;
getopt("a:b:hv", \%options);
die $help if exists $options{h};
die $help unless $options{a};
die $help unless $options{b};
my $first_vector = $options{a};
my $second_vector = $options{b};
my $minus_result = $first_vector - $second_vector;
if (exists $options{v}) {
print "minus_result is $minus_result\n";
}
else {
print "$minus_result\n";
}
#-------------------------------------
Thanks!
Davy