in reply to Re: What is the correct definition of False and Null in Perl?
in thread What is the correct definition of False and Null in Perl?

> Adding 0 to the variable makes Perl explicitly convert the string to a number:

However there is still confusion with some number formats like hexadecimal, because Perl only converts strings which represent integers or floats as decimals! (see perlnumber).

just run

$a="0x10"; ++$a;

and in Perl $a is now 1 in JS it's 17!

Cheers Rolf

UPDATE: OTOH JS obviously can't handle octals the same way:

repl> $a=010; ++$a 9 repl> $a="010"; ++$a 11

Replies are listed 'Best First'.
Re^3: What is the correct definition of False and Null in Perl? [non-decimal strings]
by flexvault (Monsignor) on Oct 09, 2011 at 13:20 UTC

    I redid your code, dropping the quotes as:

    $a=0x10; ++$a; print "$a\n";

    And the result was 17 (perl5.10.1 and perl5.12.2), which I think was what you wanted.

    P.S. I am amazed how many good comments have come from this question and the PM answers.

    Thank you

    "Well done is better than well said." - Benjamin Franklin