There's more than one way to do things | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
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 ??
--- In reply to 0.123, float or integer by guha
|
|