How do I convert a string to number in Perl?
Example:
$str = '10.0500000';
$number = $str * 1; # 10.05
Is there another standard way to get 10.05 from ‘10.0500000’ instead of multiplying with one?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
edit 2020: Answer is wrong, see comment below. I am not permitted to delete an accepted answer.
I am answering the literal question. Perhaps you want to format the number for display.
Both expressions
return the string
10.05.