On Sat, 23 Nov 2002 19:42:21 -0800, [EMAIL PROTECTED] (John W. Krahn) wrote: > >If rounding does what you want then that should be fine. However, if >you want to truncate this is one way to do it: > >my $amount = 11555.993333; > >$amount =~ s/(?<=\.\d\d)\d+$//; > > > >John
So to put it all together. I am able to re-format a money datatype in dollars to integer pennies with truncate/pad like so $amount = -11555; $amount = -11555.9999; $amount = -11555.9; $amount =~ s/(?<=\.\d\d)\d+$//; $amount .= ".00" unless $amount =~ tr/.//; $amount .= "0" unless $amount =~ /\.\d\d$/; $amount =~ tr/[0-9][\-]//cd; print "$amount\n"; Thank you for your help. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]