in reply to
decimal places
I think
rasta
was on the right path, but then took a left turn at the last second, as
"%2d"
formats to two digits, not two decimal places.
my $percent = sprintf("%.2f", ($amount * 100 / $length));
Where
printf
prints out the result,
sprintf
will return the result without printing, or in another sense, print to a string.
Comment on
Re: Decimal Places
Download
Code
In Section
Seekers of Perl Wisdom