Hello folks! Is there a function that converts a string to a number (or integer, or real) in perl? I'm trying to look it up in the perl book I have, but it's the classic "looking up a word you can't spell in the dictionary" problem.
You shouldn't have to worry about it. If you use a string that contains a number as if it were a number, perl will treat it as a number. perl doesn't strongly type anything, so there's really no such thing as integers or reals in perl either - they're all treated as floating point numbers. For example, this code will work fine:
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.