Reputation: 61
Testing the Getopt::Long perl and when executed with arguments to options print command output is 1 instead supplied argument.
Here is the code..Could not locate what is missing here.
#!c:\Perl\bin
use Getopt::Long;
(@ARGV) or die "$0 --file <file name> --cb <CBEntry>";
GetOptions( "file" => \$file,
"cb" => \$cb) or die "$0 --file <file name> --cb <CBEntry> :$! \n";
#print @ARGV;
print $file;
print $cb;
Upvotes: 0
Views: 92
Reputation: 385657
The following indicates a argument-less option:
"file" => \$file
To accept a string argument, use the following:
"file=s" => \$file
Upvotes: 3