Replace, $time = ($time * 2.0);
to $time = sprintf("%0.2f", ($time * 2)); That should do it. perldoc -f sprintf -- Rex On 8/17/05, Vineet Pande <[EMAIL PROTECTED]> wrote: > Hi: > > In the following piece of script, I would like to convert the $time after * > by 2.0 to floating point, for instance i want 0*2 to be printed as 0.0; How > to do that? > > > if ($_ =~ ( /TEMP/ )) > > { > > my $time = (substr($_, 30, 14)); > $time =~ s/\s//g; > my $temp = (substr($_, 53, 10)); > $temp =~ s/\s//g; > $time = ($time * 2.0); > $time = ?????????????????#convert to floatpoint > foreach ($time) > { > print OUT $time ; > print OUT " "; > foreach ($temp) { > print OUT $temp; > print OUT "\n"; > } > } > > } > > > cheerio > vineet > > _________________________________________________________________ > FREE pop-up blocking with the new MSN Toolbar - get it now! > http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/ > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>