In a message dated 1/28/02 1:16:55 AM Pacific Standard Time,
[EMAIL PROTECTED] writes:
>
I have a sub routine that I use for making all numbers calculate to two
decimals places which I use for calculating money values.
I will place it on my website.
The site is new and only displays well in
Stuart Clark wrote:
> Hi,
> I am trying to move the decimal point 2 places to the the left.
>
> Eg : To make 4536233 into 45362.33
>
> I tried this
> $total = "4536233";
> $total = sprintf("%0.2f",$total);
> print "$total";
&
--- Leon <[EMAIL PROTECTED]> wrote:
> Try this;
> my $total = "4536233";
> $total =~s/(.+)(\d{2})/$1.$2/;
> print $total;
Ooh... I'd be careful of a regex like that.
$ perl -e '
> $foo = "I told you 100 times not to do that :)";
> $foo =~ s/(.+)(\d{2})/$1.$2/;
> print $foo'
I told you 1.00 time
Try this;
my $total = "4536233";
$total =~s/(.+)(\d{2})/$1.$2/;
print $total;
- Original Message -
From: "Stuart Clark" <[EMAIL PROTECTED]>
To: "Perl List" <[EMAIL PROTECTED]>
Sent: Sunday, January 27, 2002 5:56 PM
Subject: decimal point
>
Stuart Clark wrote:
>
> Hi,
Hello,
> I am trying to move the decimal point 2 places to the the left.
>
> Eg : To make 4536233 into 45362.33
>
> I tried this
> $total = "4536233";
> $total = sprintf("%0.2f",$total);
> print "$total"
did i say 10? i meant 100
-Original Message-
From: Darren Simpson
Sent: 28 January 2002 08:48
To: 'Stuart Clark'; Perl List
Subject: RE: decimal point
i would try dividing the number by 10
-Original Message-
From: Stuart Clark [mailto:[EMAIL PROTECTED]]
Sent: 28 Ja
in between...
hope this helps...
regs,
sachin balsekar.
Stuart Clark wrote:
>Hi,
>I am trying to move the decimal point 2 places to the the left.
>
>Eg : To make 4536233 into 45362.33
>
>I tried this
>$total = "4536233";
>$total = sprintf("%0.2f&quo
i would try dividing the number by 10
-Original Message-
From: Stuart Clark [mailto:[EMAIL PROTECTED]]
Sent: 28 January 2002 01:57
To: Perl List
Subject: decimal point
Hi,
I am trying to move the decimal point 2 places to the the left.
Eg : To make 4536233 into 45362.33
I tried
Hi,
I am trying to move the decimal point 2 places to the the left.
Eg : To make 4536233 into 45362.33
I tried this
$total = "4536233";
$total = sprintf("%0.2f",$total);
print "$total";
But I get this
4536233.00
Can anyone help please
Regards
Stuart Clark
use strict;
my $var=4536233;
my $new_var=$var/100;
print $new_var;
Shawn
- Original Message -
From: "Stuart Clark" <[EMAIL PROTECTED]>
To: "Perl List" <[EMAIL PROTECTED]>
Sent: Sunday, January 27, 2002 7:56 PM
Subject: decimal point
> Hi,
> I
Hi,
I am trying to move the decimal point 2 places to the the left.
Eg : To make 4536233 into 45362.33
I tried this
$total = "4536233";
$total = sprintf("%0.2f",$total);
print "$total";
But I get this
4536233.00
Can anyone help please
Regards
Stuart Clark
11 matches
Mail list logo