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


In reply to Script failed with certain value in the variable by mamoru0916

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.