> You cannot reference a variable that has not been defined yet.
That helps somewhat, but you can certainly assign to a variable you haven't defined. Detect that.
> Contrast that with, say, Perl....
If you'd used the warnings pragma, Perl would happily have warned you about any problems numifying the string. In this case, there are no problems numifying the string, so there's no warning.
(As Perl is an operator-oriented language, the use of syntax which provides numeric or boolean or string context on values indicates programmer intent.)
That helps somewhat, but you can certainly assign to a variable you haven't defined. Detect that.
> Contrast that with, say, Perl....
If you'd used the warnings pragma, Perl would happily have warned you about any problems numifying the string. In this case, there are no problems numifying the string, so there's no warning.
(As Perl is an operator-oriented language, the use of syntax which provides numeric or boolean or string context on values indicates programmer intent.)