my @values = ('5.5', '9', '19.95'); foreach my $value (@values) { my $dollars = int $value; my $cents = $value - $dollars; my $converted_value = sprintf "\$$dollars.%02d", int ($cents * 100 + + .5); print "$converted_value\n"; } ---- $5.50 $9.00 $19.95
------
We are the carpenters and bricklayers of the Information Age.
Vote paco for President!
In reply to Re: Dollars and regex cents
by dragonchild
in thread Dollars and regex cents
by higle
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |