P is for Practical | |
PerlMonks |
Need some wisdom on strings to numbersby decebel (Acolyte) |
on Oct 07, 2009 at 02:08 UTC ( [id://799634]=perlquestion: print w/replies, xml ) | Need Help?? |
decebel has asked for the wisdom of the Perl Monks concerning the following question: Hello Monks, Here I come again to seek some wisdom on a minor issue that has been bothering me since this afternoon. Basically, I have 2 variables and I am converting them to numbers:
Below is the output from the print Dumper statement: { 'num1' => 123, 'num2' => '123.1' };As you can see, variable num1 gets converted to a number but num2 is not. num2 value 123.1 is surrounded in quotes and remains as a string. As a second part of the question, what is an easy way to check if a string is a number and are there any standard ways to convert them to numbers Thanks a lot in advance, Dece
Back to
Seekers of Perl Wisdom
|
|