Ohasub tostring { my $cent = "00". shift; $cent =~ s/(\d\d)$/.$1/; $cent =~ s/^0+(\d)/$1/; 1 while($cent =~ s/(\d)(\d\d\d[.'])/$1'$2/); $cent; } print tostring(2)." + ".tostring(99998)." = ".tostring(100000)."\n"; # => .02+999.98=1'000.00
In reply to Re: Multiplication problem
by oha
in thread Multiplication problem
by John Vanbeek
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |