in reply to Unknown Arithmetic Warning: Cannot determine source

$sec[2] is your problem.

Runtime warnings triggered in elsif conditions are reported with the line number of the original if condition. This longstanding but difficult to fix bug often confuses people.

Replies are listed 'Best First'.
Re^2: Unknown Arithmetic Warning: Cannot determine source
by ikegami (Patriarch) on Nov 04, 2008 at 08:09 UTC
    I don't know when it was fixed, but it's fixed in 5.8.8.
    >perl580\bin\perl -we"$cur[2]=20; $win[2]=100; $sec[2]=undef; if ($cur +[2] > $win[2]) {}" -e"elsif (0+$cur[2] > 0+$sec[2]) {}" Use of uninitialized value in addition (+) at -e line 1. >perl588\bin\perl -we"$cur[2]=20; $win[2]=100; $sec[2]=undef; if ($cur +[2] > $win[2]) {}" -e"elsif (0+$cur[2] > 0+$sec[2]) {}" Use of uninitialized value in addition (+) at -e line 2.
      I can't duplicate your result:
      ~$ perl5.8.8 -we'$cur[2]=20; $win[2]=100; $sec[2]=undef; if ($cur[2] > + $win[2]) {}' -e'elsif (0+$cur[2] > 0+$sec[2]) {}' Use of uninitialized value in addition (+) at -e line 1.
      And the same on 5.8.9-to-be.

      perl588\bin\perl -V?

        ActivePerl 5.8.8 build 824

        It appears to be the result of a patch applied by ActiveState, since it wasn't fixed in build 817.

        >perl588_817\bin\perl -we"$cur[2]=20; $win[2]=100; $sec[2]=undef; if ( +$cur[2] > $win[2]) {}" -e"elsif (0+$cur[2] > 0+$sec[2]) {}" Use of uninitialized value in addition (+) at -e line 1. >perl588\bin\perl -we"$cur[2]=20; $win[2]=100; $sec[2]=undef; if ($cur +[2] > $win[2]) {}" -e"elsif (0+$cur[2] > 0+$sec[2]) {}" Use of uninitialized value in addition (+) at -e line 2.

        Ignoring whitespace changes, the only difference between the -MO=Concise of b817 and b824 is

        - <1> null vK/1 ->- s <|> and(other->t) vK/1 ->k +- <@> lineseq sK ->s +- <0> ex-nextstate v* ->l r <2> gt sK/2 ->s n <2> add[t7] sK/2 ->o