Problem
Converting a string scalar into a number.
Solution
To convert a string scalar to a number, just add zero.
Sometimes Perl calculations get a bit screwed, when Perl decides it is dealing with a string – not a number.
Example
Here is the code to fix it up:
print $scalar + 0;
$str+=0;