I have a perl file which basically takes input as follows:
use strict;
use File::Copy;
use File::Path;
use Sys::Hostname;
use Getopt::Long;
use File::Spec;
use File::Compare;
use MIME::Base64;
use Digest::MD5 qw(md5_hex);
my %hmpParams;
my $keybindings;
my $keybindings1;
my $keybindings2;
my $filename;
my $osname;
my $copy="cp";
&parseCommandLineParams();
while ((my $k, my $v) = each %hmpParams ){
print($k . " = " . $v . "\n");
}
sub parseCommandLineParams(){
GetOptions ( 'bindings:s' => \$hmpParams{bindings},
'filename:s' => \$hmpParams{filename},
'key:s' => \$hmpParams{key},
'bindings1:s' => \$hmpParams{bindings1},
'bindings2:s' => \$hmpParams{bindings2}
);
}
I am executing this Perl file as follows:
perl test.pl "-bindings" "+WBAOBtud/UuM7uuCG2T+0ZvoCeuu/x24ovYkwjI2YM=" "-filename" "/tmp/keyMapperFile_2016-08-24-04:43:06" "-key" "avqijvmlf5ipq_5j0038opvhqmh_28jm8d913ptv0_3ie1ctia2cdqd" "-bindings1" "" "-bindings2" ""
Output:
Unknown option: wbaobtud/uum7uucg2t+0zvoceuu/x24ovykwji2ym
bindings2 =
filename = /tmp/keyMapperFile_2016-08-24-04:43:06
bindings =
bindings1 =
key = avqijvmlf5ipq_5j0038opvhqmh_28jm8d913ptv0_3ie1ctia2cdqd
I see that whenever there is a preceding + sign in the value of an option it does not recognizes it as value but instead treats it as option. How do I get around this error? What is the reason behind this?
perl test.pl --bindings "+WBAOBtud/UuM7uuCG2T+0ZvoCeuu/x24ovYkwjI2YM=" --filename ...- Chankey Pathak