in reply to Question re numbers and strings
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Question re numbers and strings
by ultranerds (Hermit) on Jan 13, 2011 at 09:06 UTC | |
by ww (Archbishop) on Jan 13, 2011 at 13:14 UTC |