mamoru0916 has asked for the wisdom of the Perl Monks concerning the following question:
I'm running perl on windows with active perl 5.24 x64. This mystery issue is really bothering me. So, I'm here to seeking for some wisdom.
Lets call my script getopt.pl and it takes the input and doing something. However, whenever the value in the variable is "E48.2", the value is creating issue causing the script to fail miserably.
Input: 1. getopt.pl --platform=1 --version=E48.1 ..... ok 2. getopt.pl --platform=1 --version=E48.2 ..... Failed 3. getopt.pl --platform=1 --version=48.2 ..... ok 4. getopt.pl --platform=1 (script find version value E48.2) ... failed Sample code: use Getopt::Long; my $platform = 0; my $version = undef; my $suffix = undef; my $flag1 = 0; my $flag2 = 0; GetOptions ('platform=i' => \$platform, 'version=s' => \$version, 'suffix=s' => \$suffix, 'flag1' => \$flag1, 'flag2' => \$flag2,); if ($platform == 1) { if (!defined($version)) { Find version number!! $version = E . "$valuefind"; ($version will be E48.2) } print "Find version: " . $version . "!\n"; if (!defined(Suffix) && defined($version)) { Find suffix value, let's say suffix is F!! } print "Find suffix: " . $suffix . "!\n"; } Output for each input is like: 1. Find version: E48.1! Find suffix: F! 2. Find version: E48.2! Use of uninitialized value $suffix in concatenation (.) or string a +t getopt.pl. 3. Find version: 48.2! Find suffix: F! 4. Find version: E48.2! Use of uninitialized value $suffix in concatenation (.) or string a +t getopt.pl.
For some reason, when the value in $version is E48.2, the script can't enter the last if clause to find the $suffix value. Tried a few other number all seems to be okay....E48.3, E48.4 .. 5.. 6.. E74.0 E64.5 ... etc
Chris
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Script failed with certain value in the variable
by marinersk (Priest) on Mar 18, 2017 at 07:41 UTC | |
|
Re: Script failed with certain value in the variable
by shmem (Chancellor) on Mar 18, 2017 at 14:36 UTC | |
|
Re: Script failed with certain value in the variable
by huck (Prior) on Mar 18, 2017 at 03:37 UTC | |
|
Re: Script failed with certain value in the variable
by mr_ron (Deacon) on Mar 18, 2017 at 14:59 UTC | |
|
Re: Script failed with certain value in the variable
by stevieb (Canon) on Mar 18, 2017 at 01:08 UTC |