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

Re: decimal point

Thread Previous | Thread Next
sachin balsekar
January 28, 2002 01:16
Re: decimal point
Message ID:
Dear Stuart,

The Sprintf function may not be able to change the value of the scalar 
variable $total...its only used to format the value for display...

so dividing by 100 seems to be the only way out...or you could use 
string functions to fetch the substrings and concatenate them with 
decimal in between...

hope this helps...

sachin balsekar.

Stuart Clark wrote:

>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
>Can anyone help please
>Stuart Clark

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About