I'm new to Perl and I was wondering if there is a way for numerical variables to hold extra zeros, (1.0 instead of 1) I know you can do this in java. Can any one help? thanks!
Variables in perl can be string or numeric (or indeed other things like references).
To store 1.0 you just:
Code:
my $var = '1.0';
Wrap it up in quotes to make it a string.
If you alter it with a maths operator then you'll need to reformat it afterwards with something like "sprinf".
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.