|No such thing as a small change|
0.123, float or integerby guha (Priest)
|on Feb 05, 2002 at 23:02 UTC||Need Help??|
guha has asked for the wisdom of the Perl Monks concerning the following question:
Today I ran into a puzzler regarding how perl interprets a scalar.
The problem cropped up in a program that basically gets a large string from a database and then using substr extracts substrings.
Some of these substrings are ASCII representations of floats, ie 0.123 or 21.654.
The odd thing is that when these values are used for calculations they will behave as if they were integers. For example multiplying a scalar, say $v2, containing 21.654 with 2 yields the result 42!!
Trying to duplicate the problem with a small testscript failed, that is it works as expected.
Any ideas someone ??