When you use a variable as a number, Perl tries hard to make it a number if it's not stored as a number internally. In Perl it's the operator that provides the context, and the data is transformed to fit to the operation.
In the case of "1abc" the result is 1, plus a warning (if you have warnings enabled, as I strongly recommend). So it is indeed a number, if viewed as one.
The test you might want to use instead is implemented in Scalar::Util::looks_like_number
In reply to Re: Question re numbers and strings
by moritz
in thread Question re numbers and strings
by ultranerds
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |