At 08:53 AM 6/20/2007 +0530, jagdish eashwar wrote:
>I got an idea after your suggestion that I should explore the Text::Wrap
>module. If I can get perl to split the string after every so many
>characters, I'll have achieved what I want. Is that possible?
That's exactly what Text::Wrap does. If
sponding perl control character? I
need
to split a multi line string from a word table cell at the word wraps.
jagdish eashwar
-- next part --
An HTML attachment was scrubbed...
URL:
http://aspn.activestate.com/ASPN/Mail/Browse/Threaded
How about
#!/usr/bin/perl -w
use strict;
my $number = 10.25233006477356 ;
my $truncatedNumber = sprintf("%10.6f", $number) ;
print $truncatedNumber ;
Result: 10.252330
Keeping in mind that %10.6f is the format for a floating point number with 9
digits and the decimal point or a total of 10. If
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
John Townsend
Sent: Wednesday, 20 June 2007 10:50 a.m.
To: perl-win32-users@listserv.activestate.com
Cc: Chad Freeman
Subject: Truncating decimal number
I'm trying to truncate a number, 10.25233006477356, to 6 decimal points.
E.g. 10
8<--
I'm trying to truncate a number, 10.25233006477356, to 6 decimal points. E.g.
10.252330.
I don't need to round the number, I just want it to drop everything after the
6th decimal point. This should be easy, but I'm drawing a blank.
8<-
At 03:50 PM 6/19/2007 -0700, John Townsend wrote:
>I don't need to round the number, I just want it to drop everything
>after the 6th decimal point. This should be easy, but I'm drawing a
>blank.
If u really need to truncate it and can't use sprintf for some reason u can
do this.
sub trunc {
John Townsend wrote:
> I’m trying to change a space to an escaped space.
>
> I've tried something like this:
>
> $string = "._\\agmptestapp.exe_ -i
> ._\\performance_in\\3Pages3Squares.pdf_
> -o ._\\performance_out\\_
> -1 -dic never -t ps3 -s irs -ppd AdobePDF
> 8.0 -timer > timer.txt";
>
I'm trying to change a space to an escaped space.
I've tried something like this:
$string = ".\\agmptestapp.exe -i .\\performance_in\\3Pages3Squares.pdf
-o .\\performance_out\\ -1 -dic never -t ps3 -s irs -ppd AdobePDF 8.0
-timer > timer.txt";
$string =~ s, ,\ ,g;
print "string after\n$string\n";
Hi John,
What about the function sprintf ?
I think you can use something like
my $decimale = 10.2345678879;
The number sprintf("%.6f", $decimale) is what you are look for, isn't?
I did this test
my $number = 10.5432634657656;
my $result = 0;
$result = sprintf("%.6f", $number);
print "$resul
John,
Have you thought of using the SPRINTF function?
e.g.:
my $temp1 = 10.25233006477356;
my $temp2 = sprintf("%.6f", $temp1);
print $temp2;
>> 10.252330
I realize that the SPRINTF will round, but "not needing" and "not wanting"
are two different situations.
I'm trying to truncate a number, 10.25233006477356, to 6 decimal points.
E.g. 10.252330.
I don't need to round the number, I just want it to drop everything
after the 6th decimal point. This should be easy, but I'm drawing a
blank.
Thanks
___
Perl-Win32
At 09:40 AM 6/19/2007 -0700, Michael Higgins wrote:
>> Do word processors insert any character for word wraps like
>> they do for new lines(\n)? If yes, what is the corresponding
>> perl control character? I need to split a multi line string
>> from a word table cell at the word wraps.
Not tha
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On
> Behalf Of jagdish eashwar
> Sent: Tuesday, June 19, 2007 8:38 AM
> To: perl-win32-users@listserv.activestate.com
> Subject: control characters in perl
>
> Hi,
>
> Do word processors insert any character for
Hi,
Do word processors insert any character for word wraps like they do for new
lines(\n)? If yes, what is the corresponding perl control character? I need
to split a multi line string from a word table cell at the word wraps.
jagdish eashwar
___
Perl-
14 matches
Mail list logo