On 2011-11-29 14:49, Chris Stinemetz wrote:
How can I check that the value assigned to $cell and $sector is numeric
before I try to call the sprintf function?
I am just trying to clear this warning.
Argument "" isn't numeric in sprintf at ./rt_evdo_pcmd.pl line 139,<$FIN&g
Chris Stinemetz wrote:
How can I check that the value assigned to $cell and $sector is numeric
before I try to call the sprintf function?
I am just trying to clear this warning.
Argument "" isn't numeric in sprintf at ./rt_evdo_pcmd.pl line 139,<$FIN>
line 119503.
Hi Chris,
On Tue, 29 Nov 2011 07:49:37 -0600
Chris Stinemetz wrote:
> How can I check that the value assigned to $cell and $sector is numeric
> before I try to call the sprintf function?
>
> I am just trying to clear this warning.
>
> Argument "" isn't numeri
How can I check that the value assigned to $cell and $sector is numeric
> before I try to call the sprintf function?
>
> I am just trying to clear this warning.
>
> Argument "" isn't numeric in sprintf at ./rt_evdo_pcmd.pl line 139, <$FIN>
> line 119503.
&g
How can I check that the value assigned to $cell and $sector is numeric
before I try to call the sprintf function?
I am just trying to clear this warning.
Argument "" isn't numeric in sprintf at ./rt_evdo_pcmd.pl line 139, <$FIN>
line 119503.
line 139 is from my progr
Majian wrote:
I found these :
perl -e'print 01.234 + 01.234', "\n"'
perl -e'print 01.234 + 011.234' "\n"'
perl -e'print 01.234.12 + 01.234', "\n"'
And the results were :
1235234
1235234
1235.12234
For other surprises, try also:
perl -wle 'print length(01.234.12)'
perl -wle 'print 01.234.12'
2009/10/25 Majian :
> I found these :
> perl -e'print 01.234 + 01.234', "\n"'
print (01).(234+01).234, "\n";
this evaluates to '1'.'235'.'234'
> perl -e'print 01.234 + 011.234' "\n"'
I didn't get 1235234, I got 1243234.
print (01).(234+011).(234),"\n"
evaluates to
print '1'.(234+9).'234',"\n";
~~
On Sat, Oct 24, 2009 at 7:28 PM, Peter Scott wrote:
> On Wed, 21 Oct 2009 20:52:05 +0800, Majian wrote:
> > And I modify it like this "sprintf "The number in
> > scientific
> > notation is %e", 01.255;"
> >
On Wed, 21 Oct 2009 20:52:05 +0800, Majian wrote:
> And I modify it like this "sprintf "The number in
> scientific
> notation is %e", 01.255;"
> The screen now output is " The number in scientific
>
On 21 Okt, 14:52, jian...@gmail.com (Majian) wrote:
> Hi, all ;
>
> I want to print this sentence " The number in scientific
> notation is 1.255000e+02".
>
> So I write a perl script like this :
> #!/usr/bin/perl
>
>
> sprintf "The number in scientific notation is %e", 1.255;
>
Sprintf doesn't print actually, it just returns a string based on the
formats provided in the list you have.
To actually print something you should use printf.
printf "The number in scientific no
At 8:52 PM +0800 10/21/09, Majian wrote:
Hi, all ;
I want to print this sentence " The number in scientific
notation is 1.255000e+02".
So I write a perl script like this :
#!/usr/bin/perl
sprintf "The number in scientific
Hi, all ;
I want to print this sentence " The number in scientific
notation is 1.255000e+02".
So I write a perl script like this :
#!/usr/bin/perl
sprintf "The number in scientific notation is %e", 1.255;
But
On 2/19/09 Thu Feb 19, 2009 7:56 AM, "John W. Krahn"
scribbled:
> Thank you for reading the documentation to me but '%1\$s' is not the
> same as '%1$s'.
True. However, I think the point should be made that "%1\$s" is in fact the
same as '%1$s'
Rob is using double-quotes in his program.
I wo
Rob Dixon wrote:
John W. Krahn wrote:
Strings like '%1\$s16->' are not valid sprintf/printf formats. What
does your data look like and what do you expect it to look like after
using sprintf?
From perldoc -f sprintf:
format parameter index
An explicit format parameter inde
John W. Krahn wrote:
>
> Strings like '%1\$s16->' are not valid sprintf/printf formats. What
> does your data look like and what do you expect it to look like after
> using sprintf?
>From perldoc -f sprintf:
> format parameter index
> An explicit format
y @phraseA = ("%1\$s16-> ", "%2\$s16-> ", "%3\$s16-> ");
i also had to convert the array to a scalar for the InsertPitches subroutine
to work correctly with the sprintf.
thanks again to John and Jim for your hints,
rob
this now works for me
my @phraseA
On 2/18/09 Wed Feb 18, 2009 10:20 AM, "Rob Canning"
scribbled:
> John W. Krahn said :
>> Rob Canning wrote:
>>> hi i have a sprintf which uses a scalar as its format:
>>> my $Bformat = "%1\$s16-> %2\$s16 %3\$s16 %4\$s16 %5\$s16 %6\$s16-> %7\$
John W. Krahn said :
> Rob Canning wrote:
>> hi i have a sprintf which uses a scalar as its format:
>> my $Bformat = "%1\$s16-> %2\$s16 %3\$s16 %4\$s16 %5\$s16 %6\$s16-> %7\$s16
>> %8\$s16"
>>
>>
>> what i would like to do is generate a ne
Rob Canning wrote:
hi i have a sprintf which uses a scalar as its format:
my $Bformat = "%1\$s16-> %2\$s16 %3\$s16 %4\$s16 %5\$s16 %6\$s16-> %7\$s16
%8\$s16"
what i would like to do is generate a new format for the sprintf by doing
permutations of 5 arrays like this:
my @
hi i have a sprintf which uses a scalar as its format:
my $Bformat = "%1\$s16-> %2\$s16 %3\$s16 %4\$s16 %5\$s16 %6\$s16-> %7\$s16
%8\$s16"
what i would like to do is generate a new format for the sprintf by doing
permutations of 5 arrays like this:
my @phraseA = qw( %1\$s1
Dermot wrote:
2009/2/4 Rob Canning :
hello,
i am new to this list and very new to pearl.
i have run into a problem i cant find a solution - i have searched the net
for an answer but as i am so new to perl (and programming in general)
perhaps i dont even know the right keywords...
ok here it
2009/2/4 Rob Canning :
> hello,
> i am new to this list and very new to pearl.
> i have run into a problem i cant find a solution - i have searched the net
> for an answer but as i am so new to perl (and programming in general)
> perhaps i dont even know the right keywords...
>
> ok here it goes..
it into the first index of the array as a string?
what i need is an @array i can use as a list in sprintf
sub InsertPitches {
my ($num, $form, @notes) = @_;
my ($output, @temp);
while (@notes) {
(@temp[0..$num-1], @notes) = @notes;
$output .= sprintf $form, (@temp);
}
ret
On Jun 4, 8:00 am, [EMAIL PROTECTED] (Rob Dixon) wrote:
> April wrote:
> > sprintf( "%s%$Fmt%s", ("%$Fmt=|", $TestStr, "|"))
>
> > This is in Perl for Dummies, 4th ed, p160.
>
> > I'm trying to understand this ...
>
> > the
April wrote:
> sprintf( "%s%$Fmt%s", ("%$Fmt=|", $TestStr, "|"))
>
> This is in Perl for Dummies, 4th ed, p160.
>
> I'm trying to understand this ...
>
> the first part, "%s%$Fmt%s", my understanding is the format part,
> whic
sprintf( "%s%$Fmt%s", ("%$Fmt=|", $TestStr, "|"))
This is in Perl for Dummies, 4th ed, p160.
I'm trying to understand this ...
the first part, "%s%$Fmt%s", my understanding is the format part,
which specifies the formats for the second part, thel
From: Steve Bertrand <[EMAIL PROTECTED]>
> >> $var = sprintf ("%.2f", (($var /=1024) /=1024)))
> >
> > What the ...?!?
> >
> > /= ?
>
> It was an off the top of my head example of what I wanted to do. Without
> being at the code at
> $var = sprintf ("%.2f", $var / (1024*1024));
>
> And it will be more efficient because the multiplication will be done
> at compile time (once) and you'll only do a single division each
> time. Which is also more precise, though in this case it doesn't seem
>> $var = sprintf ("%.2f", (($var /=1024) /=1024)))
>
> What the ...?!?
>
> /= ?
It was an off the top of my head example of what I wanted to do. Without
being at the code at the time, I was simply thinking +=.
> You divide the value of $var by 1024, assign i
From: Steve Bertrand <[EMAIL PROTECTED]>
> Hi again all,
>
> Is there a way that one can use sprintf on a variable and assign the
> value back to the variable without having the leading $var= ?
>
> $var = sprintf ("%.2f", (($var /=1024) /=1
Gunnar Hjalmarsson wrote:
> Steve Bertrand wrote:
>> Is there a way that one can use sprintf on a variable and assign the
>> value back to the variable without having the leading $var= ?
>>
>> $var = sprintf ("%.2f", (($var /=1024) /=1024)))
>
> You c
Steve Bertrand wrote:
Is there a way that one can use sprintf on a variable and assign the
value back to the variable without having the leading $var= ?
$var = sprintf ("%.2f", (($var /=1024) /=1024)))
You can write a function.
convert( $var );
sub convert { $_[0] = spr
On Nov 28, 2007, at 11:26 AM, Steve Bertrand wrote:
Is there a way that one can use sprintf on a variable and assign the
value back to the variable without having the leading $var= ?
I don't think you can do it directly, but you can use the aliasing
properties of sub o
Hi again all,
Is there a way that one can use sprintf on a variable and assign the
value back to the variable without having the leading $var= ?
$var = sprintf ("%.2f", (($var /=1024) /=1024)))
I've got a hash of hashrefs of hashrefs and I'd rather not specify the
variable
On 10/29/07, jiangfan <[EMAIL PROTECTED]> wrote:
> What is wrong with this statement?
>
> my $time = sprintf( "0x%08x", `date +%s` );
I don't know what's wrong with it on your machine, but I'd change the
command in backticks to be Perl's time o
jiangfan wrote:
> Hi,
>
> What is wrong with this statement?
>
> my $time = sprintf( "0x%08x", `date +%s` );
>
> I got
>
> "Use of uninitialized value in sprintf at /opt/MoteWorks/tos/../make/
> scripts/ident_flags line 15."
>
> Thanks.
&
Hi,
What is wrong with this statement?
my $time = sprintf( "0x%08x", `date +%s` );
I got
"Use of uninitialized value in sprintf at /opt/MoteWorks/tos/../make/
scripts/ident_flags line 15."
Thanks.
Jiangfan
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additio
On 15 Mar 2007 at 8:05, Tom Phoenix wrote:
> On 3/15/07, Beginner <[EMAIL PROTECTED]> wrote:
>
> > For some reason my sprintf usage is not returning the numbers I had
> > expected and appears to be rounding down. Is there something wrong
> > with my formatting be
On 3/15/07, Beginner <[EMAIL PROTECTED]> wrote:
For some reason my sprintf usage is not returning the numbers I had
expected and appears to be rounding down. Is there something wrong
with my formatting below.
my $ksize = sprintf("%.2f",$size/1024);
Hi,
For some reason my sprintf usage is not returning the numbers I had
expected and appears to be rounding down. Is there something wrong
with my formatting below.
=== code snip ==
my ($x,$y) = imgsize($fqn);
my $size = $x*$y*3;
my
Hello,
The simple difference is,'sprintf' format the strings and pass the result to a
variable.
$ perl -e 'my $var=sprintf "%30s\n","hello,world";print $var'
hello,world
While 'printf' print the result directly to
Hi all,
First of all I want to thank you all for reading and
replying my previous posts.
Now I come across to another problem:
I want to print out a AoA. If I use printf I get what
I expect. If I use sprintf for string I get error
messages but the remaining still look OK. But If use
sprintf
John Hennessy wrote:
[...]
I am using %03.4f to provide output that looks like 100.
I would like number less than 100. to look like 099.
I would like to keep the 3 digits prior to the decimal point either with
or without the leading zero as required.
Any suggestions welcomed.
Than
John Hennessy wrote:
> Hi, how is it possible to prefix a leading zero to the $Count result
> below when this value is less than 100. ?
>
>
> while ($count < 110.000) {
>$count += 10;
>$Count = sprintf "%03.4f", $count;
>print "Count is
Hi, how is it possible to prefix a leading zero to the $Count result
below when this value is less than 100. ?
while ($count < 110.000) {
$count += 10;
$Count = sprintf "%03.4f", $count;
print "Count is now $Count\n";
}
I am using %03.4f to provide output t
Kevin Old wrote:
> Hello everyone,
Hello,
> I'm having trouble with sprintf. I know it's some silly mistake I'm
> making, but can't seem to figure it out.
>
> Here's what I have:
>
> my @time = localtime();
> $time[4]++;
> $time[5]
- Original Message -
Hello everyone,
I'm having trouble with sprintf. I know it's some silly mistake I'm
making, but can't seem to figure it out.
Here's what I have:
my @time = localtime();
$time[4]++;
$time[5] += 1900;
my $lastmonday = sprintf("%0
- Original Message -
From: Kevin Old <[EMAIL PROTECTED]>
Date: Tuesday, September 13, 2005 5:31 am
Subject: Help with sprintf
> Hello everyone,
Hello,
> My result is: 20050901, but what I'm trying to get is 050901.
>
You can try with two possibilities:
1. Using
Hello everyone,
I'm having trouble with sprintf. I know it's some silly mistake I'm
making, but can't seem to figure it out.
Here's what I have:
my @time = localtime();
$time[4]++;
$time[5] += 1900;
my $lastmonday = sprintf("%02d", $time[5]) . sprintf(&quo
Hi Derek,
sprintf ("%.03f",($now - (stat("${hdir}${file}"))[9])/86400);
sprintf prints to a string, so you need to assign its return value to
something... or print it... or simply switch to printf.
my $value = sprintf( ... );
print $value;
or
print sprin
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> wrote:
: I am getting this error, can anyone help?
:
: sprintf ("%.03f",($now - (stat("${hdir}${file}"))[9])/86400);
Use either of these:
print sprintf "%.03f",
( $now - ( stat( "${hdir}
I am getting this error, can anyone help?
thanks
derek
# perl -c dir.pl
Useless use of sprintf in void context at dir.pl line 29.
dir.pl syntax OK
#!/usr/bin/perl
use strict;
use warnings;
use Time::localtime;
$ENV{"PATH"} = qq(/opt/SUNWsamfs/sbin:/usr/bin:/usr/sbin:/usr/local/log);
I have an 11 digit number. I want to add another number to it and format to 11
digits as well.
my $amount1 = 14313562897;
my $amount2 = 0013625;
$amount = sprintf("%011d", $amount1 + $amount2);
print $amount."\n";
The answer perl gives me is -01
How can t
On Fri, 26 Nov 2004 17:47:25 +1100, David Clarke wrote:
> As well, if the large number starts with 0, I get an "Illegal octal
> digit '8' at test.pl line 2, at end of line".
Sorry, forgot this one. A number can't start with a zero (except if it is in
front of a comma). If a number starts with a z
On Fri, 26 Nov 2004 17:47:25 +1100, David Clarke wrote:
> my $amount1 = 14313562897;
> my $amount2 = 0013625;
> $amount = sprintf("%011d", $amount1 + $amount2);
> print $amount."\n";
>
> The answer perl gives me is -01
> How can this be ?
>
Hi Dave,
my $amount2 = 0013625;
As you pointed already.
0 is an octal constant
$amount = sprintf("%011d", $amount1 + $amount2);
and: printf "%d" casts to a signed int
unfortunately the printf interface doesn't give a good way to say "deal
with this num
I have an 11 digit number. I want to add another number to it and format to 11
digits as well.
my $amount1 = 14313562897;
my $amount2 = 0013625;
$amount = sprintf("%011d", $amount1 + $amount2);
print $amount."\n";
The answer perl gives me is -01
How can th
G'day...
> Does anyone know how to format a string so that the spaces are padded
> on the right, not the left.
>
> Im using $dates = sprintf("%64s", $dates);
>
> this right justifies the data and pads the left with spaces.
> I need the other way around - l
Does anyone know how to format a string so that the spaces are padded on the
right, not the left.
Im using $dates = sprintf("%64s", $dates);
this right justifies the data and pads the left with spaces. I need the other
way around - left justified and padded with spaces on
gt;
> Can anyone give me a simple example of this - i am not having any joy
> by myself :s
Please learn how to use perldoc, Google, &/or books.
The first hit on a Google search for "perldoc sprintf" gives this:
# Round number to 3 digits after decimal point
$roun
to do is
> format a number into a currency, so 9.9 would be printed as 9.90
>
> Can anyone give me a simple example of this - i am not having any joy
> by myself :s
Please learn how to use perldoc, Google, &/or books.
The first hit on a Google search for "perldoc sprintf"
Hi all,
I am trying to figure out sprint and prinf: what I am trying to do is
format a number into a currency, so 9.9 would be printed as 9.90
Can anyone give me a simple example of this - i am not having any joy by
myself :s
Thanks in advance
Anadi
Hi all,
I am trying to figure out sprint and prinf: what I am trying to do is
format a number into a currency, so 9.9 would be printed as 9.90
Can anyone give me a simple example of this - i am not having any joy by
myself :s
Thanks in advance
Anadi
Hi all,
I am trying to figure out sprint and prinf: what I am trying to do is
format a number into a currency, so 9.9 would be printed as 9.90
Can anyone give me a simple example of this - i am not having any joy by
myself :s
Thanks in advance
Anadi
Hi all,
I am trying to figure out sprint and prinf: what I am trying to do is format
a number into a currency, so 9.9 would be printed as 9.90
Can anyone give me a simple example of this - i am not having any joy by
myself :s
Thanks in advance
Anadi
R. Joseph Newton wrote:
> All the use one could imagine. The printf function can print pretty much
> anywhere. I believe that it preceded sprintf historically, but I wouldn't
> swear
>
> Many C coders have told me that it is the most efficient way to
> write files.
Paul Kraus wrote:
> What is the difference. The only I see is that printf can take a filehandle?
> But what use would that be.
All the use one could imagine. The printf function can print pretty much
anywhere. I believe that it preceded sprintf historically, but I wouldn't swear
to
> Wiggins D Anconia wrote:
> >
> > Notice the difference in the docs:
> >
> > printf FILEHANDLE FORMAT, LIST
> > printf FORMAT, LIST
> >
> > In the first there is NO comma following the filehandle, this means it
> > is interpreted in a different manner than the rest of the argument list,
> > or p
Wiggins D Anconia wrote:
>
> Notice the difference in the docs:
>
> printf FILEHANDLE FORMAT, LIST
> printf FORMAT, LIST
>
> In the first there is NO comma following the filehandle, this means it
> is interpreted in a different manner than the rest of the argument list,
> or probably to be more pre
Wiggins D Anconia wrote:
>
> Notice the difference in the docs:
>
> printf FILEHANDLE FORMAT, LIST
> printf FORMAT, LIST
>
> In the first there is NO comma following the filehandle, this means it
> is interpreted in a different manner than the rest of the argument list,
> or probably to be more pre
> > > What is the difference. The only I see is that printf can
> >
> > One difference is printf prints it's output and sprintf
> returns it';s
> value.
> >
> > printf ...
> > my $formatted_goodies = sprintf ...
> >
> >
> > What is the difference. The only I see is that printf can
>
> One difference is printf prints it's output and sprintf returns it';s
value.
>
> printf ...
> my $formatted_goodies = sprintf ...
>
> > take a filehandle? But what use would that be.
>
> What is the difference. The only I see is that printf can take a
filehandle?
> But what use would that be.
>
The filehandle tells printf where to print the result, aka which
filehandle, by default STDOUT. Which doesn't have a purpose with
sprintf since it returns i
> What is the difference. The only I see is that printf can
One difference is printf prints it's output and sprintf returns it';s value.
printf ...
my $formatted_goodies = sprintf ...
> take a filehandle? But what use would that be.
>
To format the contents of it. For
What is the difference. The only I see is that printf can take a filehandle?
But what use would that be.
Paul Kraus
---
PEL Supply Company
Network Administrator
---
800 321-1264 Toll Free
216 267-5775 Voice
216 267-6176 Fax
www.pelsupply.com
-
Rmck wrote:
>
> How do you use a shell command in a sprintf. Im trying to add the week of the
> year to the end of my file name:
>
> my $logfile = sprintf '/var/sno/weeks/week_'. `date +%W`.'/%02d%02d%02d%02d%02d.sno',
> $year % 100, $mon + 1, $day,
On Sep 23, rmck said:
>my $logfile = sprintf '/var/sno/weeks/week_'. `date
>+%W`.'/%02d%02d%02d%02d%02d.sno',
> $year % 100, $mon + 1, $day, $hour, $min;
>
>It like its putting in a return in the $logfile?? Thanks Up front.
Yes, it is, because `...` retu
How do you use a shell command in a sprintf. Im trying to add the week of the year to
the end of my file name:
my $logfile = sprintf '/var/sno/weeks/week_'. `date +%W`.'/%02d%02d%02d%02d%02d.sno',
$year % 100, $mon + 1, $day, $hour, $min;
but when it is used I get:
ba
Rob Hanson wrote:
> > I am trying to get .15 and end up with 0.15.
>
> I don't believe that ".15" is a valid floating point value, I think there
> always has to be at least one digit to the left of the decimal... so the "f"
> format won't help.
perl -e "print .15"
OUTPUT
0.15
:)
Rob
--
David --- Senior Programmer Analyst --- Wgo Wagner wrote:
> I am trying to get .15 and end up with 0.15. I have tried a number of combinations
> of sprintf and %f.
>
> sprintf "%.2f"
> sprintf "%2.2f"
> sprintf "% .2f"
> sprintf "% 2.f&q
ve the problem since I don't
know that sprintf will help you here.
$val = sprintf("%.2f", $val);
$val =~ s/^0//;
Rob
-Original Message-
From: Wagner, David --- Senior Programmer Analyst --- WGO
[mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 30, 2003 1:09 PM
To: Beginner P
I am trying to get .15 and end up with 0.15. I have tried a number of
combinations of sprintf and %f.
sprintf "%.2f"
sprintf "%2.2f"
sprintf "% .2f"
sprintf "% 2.f"
and I always get a 0.15.
Do I
n't seem to remember the round type functions name and
> am always screwy with sprintf.
> :
> : What combo of sprintf() and round() or whatever would do
> what I'm trying to accomplish?
>
> sprintf will do a fair job of rounding for you. See the following
> docum
e and am always screwy with
sprintf.
:
: What combo of sprintf() and round() or whatever would do what I'm trying to
accomplish?
sprintf will do a fair job of rounding for you. See the following
document:
perldoc -q round
But basically, you could do:
my $rounded = sprintf '
If I have a number like so:
5.8592675
I need to make it a x.xx instead of x.x and I need to round it up to the next
hundredth like so : 5.86
I can't seem to remember the round type functions name and am always screwy with
sprintf.
What combo of sprintf() and round() or whatever
Thanks for the quick replies guys:
sprintf "%03d", $num
Did the trick, I need to study that a bit more to I think.
Thanks
Dan
> Howdy all,
>
> I know I'm being a puts but I can't for the life of me get
> sprintf to do my bidding.
>
> What I'm tr
Dan Muey wrote:
> Howdy all,
>
> I know I'm being a puts but I can't for the life of me get sprintf to
> do my bidding.
>
> What I'm tryng to do is take a number, say 5 or 10 and make them
> three digits long with Zeros on the left:
>
> IE
>
Howdy all,
I know I'm being a puts but I can't for the life of me get sprintf to do my bidding.
What I'm tryng to do is take a number, say 5 or 10 and make them three digits long
with
Zeros on the left:
IE
5 would become 005
And 10 would become 010
my $five = 5;
my $te
Hi -
> -Original Message-
> From: Konrad Foerstner [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 15, 2003 11:27 AM
> To: [EMAIL PROTECTED]
> Subject: floating-point number on the right side with sprintf
>
>
> Hi,
>
> I have a problem with formati
Hi,
I have a problem with formating my output. I use sprintf to format a
floating-point number. My output with "%.4f" looks like this:
111.5611
21.4870
10.7046
8.8443
8.6823
but I would like to see it that way:
111.5611
21.4870
10.7046
8.8443
8.6823
So,
Konrad Foerstner wrote:
> Hi,
>
> I have a problem with formating my output. I use sprintf to format a
> floating-point number. My output with "%.4f" looks like this:
>
> 111.5611
> 21.4870
> 10.7046
> 8.8443
> 8.6823
>
> but I would like to see it
Hi,
I have a problem with formating my output. I use sprintf to format a
floating-point number. My output with "%.4f" looks like this:
111.5611
21.4870
10.7046
8.8443
8.6823
but I would like to see it that way:
111.5611
21.4870
10.7046
8.8443
8.6823
So,
L PROTECTED]> wrote:
> Hi,
> Anybody know the right syntax to left justify a string with zeros using
> sprintf ot any other function? $test = "mytest";
> $test = sprintf "0%24s", $test;
> print "test";
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
On Jul 17, F.H said:
>$test = sprintf "0%24s", $test;
>
>I am getting only one zero.
Your 0 is misplaced.
sprintf '%024s', $test;
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril,
Hi,
Anybody know the right syntax to left justify a string with zeros using sprintf ot any
other function?
$test = "mytest";
$test = sprintf "0%24s", $test;
print "test";
I am getting only one zer
[mailto:[EMAIL PROTECTED]]
Sent: Monday, July 02, 2001 12:11
To: [EMAIL PROTECTED]
Subject: Format & Sprintf
Hello,
The following is based on the first example in Programming Perl,
and have a question about some of the syntax
(and or why it was doen this way)
$grades{$student} .= $g
Hello,
The following is based on the first example in Programming Perl,
and have a question about some of the syntax
(and or why it was doen this way)
$grades{$student} .= $grade . " ";
Why not $grades{$student} = $grade;
Why the concatenation and the extra space?
$average = spr
On Thu, 31 May 2001, Nichole Bialczyk wrote:
> i know that for numbers you can use sprintf %u, %i etc
>
> is there something similair for alphnumerics?
%s is used to print a string, %c is used to print a character, %% is used
to print a percent sign...
To learn more about spri
%s prints out strings
For a complete list look at:
perldoc -f sprintf
Skip to the part that begins(about the second 24 line page):
Perl's "sprintf" permits the following universally-known conversions
- Original Message -
From: "Nichole Bialczyk" <[E
1 - 100 of 104 matches
Mail list logo