Chris wrote:
>
> 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.;
> $amount = -11555.9;
> $amount =~ s/(?<=\.\d\d)\d+$//;
> $amount .= ".00" unless $amount =~ tr/.//;
> $amo
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.99;
>
>$amount =~ s/(?<=\.\d\d)\d+$//;
>
>
>
>John
So to put it all togeth
Chris wrote:
>
> On Sat, 23 Nov 2002 18:44:58 -0800, [EMAIL PROTECTED] (John W. Krahn)
> wrote:
>
> >Chris wrote:
> >>
> >> OK. I will try it. My amounts look more like this.
> >>
> >> @dollars = qw/ 12345.67 -12345.67 11555.99 -11555.99 9765.353
> >
On Sat, 23 Nov 2002 18:44:58 -0800, [EMAIL PROTECTED] (John W. Krahn)
wrote:
>Chris wrote:
>>
>> OK. I will try it. My amounts look more like this.
>>
>> @dollars = qw/ 12345.67 -12345.67 11555.99 -11555.99 9765.353
> ^^^^ ^^^
Chris wrote:
>
> How do I stop the warning message
> Possible attempt to separate words with commas at
> @dollars = qw/ $12,345.67 $11,555.99 $9,765.35 $432 $876.4 /;
my @dollars = ( '$12,345.67', '$11,555.99', '$9,765.35', '$432 $876.4'
);
John
--
use Perl;
program
fulfillment
--
To unsubs
Chris wrote:
>
> OK. I will try it. My amounts look more like this.
>
> @dollars = qw/ 12345.67 -12345.67 11555.99 -11555.99 9765.353
^^^^ ^^^
> -9765.353 432 -432 876.4 -876.4/;
^^^
You are going to have to decide if
On Sat, Nov 23, 2002 at 06:06:12PM -0500, chris wrote:
> How do I stop the warning message
> Possible attempt to separate words with commas at
> @dollars = qw/ $12,345.67 $11,555.99 $9,765.35 $432 $876.4 /;
no warnings "qw";
It is lexically scoped.
--
Paul Johnson - [EMAIL PROTECTED]
http://ww
On Fri, 22 Nov 2002 21:21:42 -0800, [EMAIL PROTECTED] (John W. Krahn)
wrote:
>Chris wrote:
>>
>> How do I tally money with perl?
>
>Assuming that you are tallying dollars like $12,345.67, convert to cents
>(an integer) by removing all punctuation and convert back to dollars to
>print the final to
On Fri, 22 Nov 2002 21:21:42 -0800, [EMAIL PROTECTED] (John W. Krahn)
wrote:
>Chris wrote:
>>
>> How do I tally money with perl?
>
>Assuming that you are tallying dollars like $12,345.67, convert to cents
>(an integer) by removing all punctuation and convert back to dollars to
>print the final to
Chris wrote:
>
> I am retrieving rows with a money datatype from a database. These are
> written to a file with 2 decimal places. I also keep a running total.
> My problem is the total does not equal to the sum of details.
>
> I have tried using
> $amount = sprintf('%.2f', $amount);
> $total += $
I am retrieving rows with a money datatype from a database. These are
written to a file with 2 decimal places. I also keep a running total.
My problem is the total does not equal to the sum of details.
I have tried using
$amount = sprintf('%.2f', $amount);
$total += $amount;
# do this after all
11 matches
Mail list logo