in reply to _ in a number within quotes

What you are seeing is a timing issue. Warnings get printed out via STDERR. Your print statements print out via STDOUT. These are two separate output streams. Sometimes one stream gets ahead of the other. $a has not yet become 2. The warning you are seeing is, in fact, coming from the $a +=1; statement.

You can see this for yourself by either finding line 6 (it is the one containing $a += 1;) or by changing all of the print statements to begin with print STDERR "...".

Best, beth

Replies are listed 'Best First'.
Re^2: _ in a number within quotes
by AnomalousMonk (Archbishop) on Apr 19, 2009 at 16:58 UTC
    That this is an OS artifact can also be seen by being explicit about the numbers of all the lines at which print statements are executed (note that on my machine, STDOUT and STDERR have not (yet) gotten out of sync):
    use strict; use warnings; my ($a, $b) = ("1_334", 1334); printf "line %ld: $a $b \n", __LINE__; $a += 1; $b += 1; printf "line %ld: $a $b \n", __LINE__; printf "line %ld: Unequal \n", __LINE__ if ($a != $b); printf "line %ld: $a $b \n", __LINE__;
    Output:
    C:\@Work\Perl\monks\dilpane>perl ubar_in_qqted_n.pl line 39: 1_334 1334 Argument "1_334" isn't numeric in addition (+) at ubar_in_qqted_n.pl l +ine 41. line 43: 2 1335 line 45: Unequal line 46: 2 1335