develooper Front page | perl.beginners | Postings from January 2002

Re: decimal point

Thread Previous
From:
Shawn
Date:
January 27, 2002 23:48
Subject:
Re: decimal point
Message ID:
180b01c1a7d0$015e06a0$d800a8c0@work
use strict;
my $var=4536233;
my $new_var=$var/100;
print $new_var;

Shawn

----- Original Message ----- 
From: "Stuart Clark" <sc@spacelink.com.au>
To: "Perl List" <beginners@perl.org>
Sent: Sunday, January 27, 2002 7:56 PM
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 this 
> $total = "4536233";
> $total = sprintf("%0.2f",$total);
> print "$total";
> But I get this
> 4536233.00
>  
> Can anyone help please
>  
> Regards
> Stuart Clark
>  
>  
>  
>  
>  
> 


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About