Re: dropping off a few decimal points

2001-07-12 Thread Will Cottay
; > perl -e '$x=1234.5678; ($y)=$x=~/(\d*\.{0,1}\d{0,2})/;print $y ."\n";' > > -Original Message- > From: Thomas Jakub [mailto:[EMAIL PROTECTED]] > Sent: July 10, 2001 15:44 > To: [EMAIL PROTECTED] > Subject: dropping off a few decimal points > &g

Re: dropping off a few decimal points

2001-07-10 Thread Casey West
On Tue, Jul 10, 2001 at 12:44:09PM -0700, Thomas Jakub wrote: : okay... so how do I drop of all but two decimal : points in perl? Give sprintf() a try: my $float = 4.3456; [... some code ...] $float = sprintf "%.2f", $float; s?printf() will do it's best to round for you too, allthough th

RE: dropping off a few decimal points

2001-07-10 Thread Mel Matsuoka
At 04:11 PM 07/10/2001 -0400, Moon, John wrote: >One way to do it ... > > perl -e '$x=1234.5678; ($y)=$x=~/(\d*\.{0,1}\d{0,2})/;print $y ."\n";' heh...that was pretty close to perl bowling ;-) Don't do wierd contrortions with regexps when theres a simple built-in function to pull off the same r

RE: dropping off a few decimal points

2001-07-10 Thread Moon, John
One way to do it ... perl -e '$x=1234.5678; ($y)=$x=~/(\d*\.{0,1}\d{0,2})/;print $y ."\n";' -Original Message- From: Thomas Jakub [mailto:[EMAIL PROTECTED]] Sent: July 10, 2001 15:44 To: [EMAIL PROTECTED] Subject: dropping off a few decimal points okay... so

dropping off a few decimal points

2001-07-10 Thread Thomas Jakub
okay... so how do I drop of all but two decimal points in perl? __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/