Re: decimal point

2002-01-27 Thread Shawn
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 am trying to move the decimal point 2 plac

RE: decimal point

2002-01-28 Thread Darren Simpson
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 this

Re: decimal point

2002-01-28 Thread sachin balsekar
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

RE: decimal point

2002-01-28 Thread Darren Simpson
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

Re: decimal point

2002-01-28 Thread John W. Krahn
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"; > But I get this > 4536233.00 > > Can anyone help please $

Re: decimal point

2002-01-28 Thread Leon
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 > Hi, > I am trying to move the decimal point 2

Re: decimal point

2002-01-28 Thread Curtis Poe
--- 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

Re: decimal point

2002-01-28 Thread sfritz
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"; > But I get this > 4536233.00 > > Can anyone help please > > Reg

Re: decimal point

2002-02-07 Thread Motherofperls
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