, 2013 8:49 AM
*Subject:* Re: formatting a list
On Fri, 27 Sep 2013 22:59:01 -0700 (PDT)
Rajeev Prasad rp.ne...@yahoo.com wrote:
...
I'm not bucking for net nanny but, while full solutions and follow-on
discussions can be enlightening, I wonder if they're really advantageous to
the OP
thank you Shawn. this works nicely for me.
From: Shawn H Corey shawnhco...@gmail.com
To: beginners@perl.org
Cc: Rajeev Prasad rp.ne...@yahoo.com
Sent: Saturday, September 28, 2013 8:49 AM
Subject: Re: formatting a list
On Fri, 27 Sep 2013 22:59:01 -0700
Hi Rajeev,
On Fri, 27 Sep 2013 22:59:01 -0700 (PDT)
Rajeev Prasad rp.ne...@yahoo.com wrote:
hello,
following is obtained by concatenating 3 values using an underscore to
produce a list:
abc_12_4567
xy4z_xtr4_sdf
PQRSDR_xcvf_scc234
i want them to look neat, something like this: where
Hi Rajeev,
I guess you can use printf to print them into strings, and then replace the
spaces with underscores.
Regards,
Jing
2013/9/28 Rajeev Prasad rp.ne...@yahoo.com
hello,
following is obtained by concatenating 3 values using an underscore to
produce a list:
abc_12_4567
ofc it should be sprintf...
2013/9/28 Rajeev Prasad rp.ne...@yahoo.com
hello,
following is obtained by concatenating 3 values using an underscore to
produce a list:
abc_12_4567
xy4z_xtr4_sdf
PQRSDR_xcvf_scc234
i want them to look neat, something like this: where they look in line. I
Hi Jing,
On Sat, 28 Sep 2013 16:53:20 +0800
Logust Yu logus...@googlemail.com wrote:
Hi Rajeev,
I guess you can use printf to print them into strings, and then replace the
spaces with underscores.
The problem with using sprintf and a replace operation like that, like you
suggest is that it
On 28/09/2013 06:59, Rajeev Prasad wrote:
hello,
following is obtained by concatenating 3 values using an underscore to
produce a list:
|abc_12_4567
xy4z_xtr4_sdf
PQRSDR_xcvf_scc234|
i want them to look neat, something like this: where they look in line.
I do not know before hand how long
On 28/09/2013 06:59, Rajeev Prasad wrote:
hello,
following is obtained by concatenating 3 values using an underscore to
produce a list:
|abc_12_4567
xy4z_xtr4_sdf
PQRSDR_xcvf_scc234|
i want them to look neat, something like this: where they look in line.
I do not know before hand how long
On Fri, 27 Sep 2013 22:59:01 -0700 (PDT)
Rajeev Prasad rp.ne...@yahoo.com wrote:
i want them to look neat, something like this: where they look in
line. I do not know before hand how long each word would be
abc124567
xy4z___xtr4__sdf
PQRSDR_xcvf__scc234
how could i use the
Hi Mike,
On Sun, 12 Feb 2012 10:14:42 -0600
Mike Blezien mick...@frontiernet.net wrote:
Hello,
Need a little assistance formatting numbers pulled from a databaes. Many are
like this:
179550, 45960, 890458 etc.
what I need to do is format these values with a comma so they look like
On 12/02/2012 16:14, Mike Blezien wrote:
Need a little assistance formatting numbers pulled from a databaes. Many
are like this:
179550, 45960, 890458 etc.
what I need to do is format these values with a comma so they look like
this:
179,550, 45,960, 890,458
What is the easiest way to do
: Mike Blezien
Sent: Sunday, February 12, 2012 10:46 AM
Subject: Re: Formatting Numbers
On 12/02/2012 16:14, Mike Blezien wrote:
Need a little assistance formatting numbers pulled from a databaes. Many
are like this:
179550, 45960, 890458 etc.
what I need to do is format
On Tue, 2008-09-16 at 17:32 -0700, [EMAIL PROTECTED] wrote:
Hello
I am sure the answer to this question is very simple. I have a number value
which I am inserting into a string I am building. How can I append the number
into the string so that it will always be 2 characters in length? In
2008/9/17 [EMAIL PROTECTED]:
Hello
I am sure the answer to this question is very simple. I have a number value
which I am inserting into a string I am building. How can I append the number
into the string so that it will always be 2 characters in length? In other
words if the month is 9,
[EMAIL PROTECTED] wrote:
Hello
Hello,
I am sure the answer to this question is very simple. I have a number
value which I am inserting into a string I am building. How can I
append the number into the string so that it will always be 2
characters in length? In other words if the month is 9,
On Tue, Apr 29, 2008 at 6:06 PM, melody [EMAIL PROTECTED] wrote:
snip
#!/usr/bin/perl
use warnings;
use strict;
snip
Good, keep this up
snip
my @array;
my @replacearray;
snip
Try to declare your variables where you initialize them.
snip
open FHR,'',repl.txt;
open
On Nov 26, 2007 5:10 PM, neil [EMAIL PROTECTED] wrote:
Hi,
I was wondering if its possible to get the class= field passed to
the tables generated by checkbox_group()?
Not a direct answer to your question, but you will want to move away
from using CGI to generate HTML and move toward using a
Yup, lol...
Wish I understood this! What is the line that does the search called? What do I
look up to read up on this?
Thanks!
jlc
From: Prabu Ayyappan [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 03, 2007 10:55 PM
To: Joseph L. Casale; beginners@perl.org
Subject: Re: formatting a string
. Casale; beginners@perl.org
Subject: Re: formatting a string
A quick solutionMay be you can enhance it more as you like..
@discarr = ('/vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/AN-DC
(Win2003 Ent x64)/AN-DC (Win2003 Ent
x64).vmx','/vmfs/volumes/467f06a5-7d59c067-35cb
On 07/03/2007 08:32 PM, Joseph L. Casale wrote:
I have an array with the following data in it:
/vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/AN-DC (Win2003 Ent x64)/AN-DC
(Win2003 Ent x64).vmx
/vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/AN-DC (Win2003 Ent x64)/Disc
1.vmdk
On 7/3/07, Joseph L. Casale [EMAIL PROTECTED] wrote:
I always deal with indices' 1 through to the end in the function in question,
so it's easy to get the second indices (First disc) and so on.
Huh?
I need to manipulate the path though now, I am wanting to search
for *all* the text
A quick solutionMay be you can enhance it more as you like..
@discarr = ('/vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/AN-DC (Win2003
Ent x64)/AN-DC (Win2003 Ent
x64).vmx','/vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/AN-DC (Win2003 Ent
x64)/Disc
Owen wrote:
I have this regex to look at an Apache log.
There are modules to help with that task on CPAN.
m/^(\S+) \S+ \S+ \[(\d{2})\/(\S+)\/(\d{4}):.+\] (\w+) (\S+)
([^]+) (\d{3}) (\d+|-) .+$/;
Would like to set it out in a bit more readable form a la Perl Cook Book and
others
eg
m/
Owen wrote:
I have this regex to look at an Apache log.
m/^(\S+) \S+ \S+ \[(\d{2})\/(\S+)\/(\d{4}):.+\] (\w+) (\S+)
([^]+) (\d{3}) (\d+|-) .+$/;
Would like to set it out in a bit more readable form a la Perl Cook Book and
others
eg
m/
^(\S+)# Comment
\S+
[EMAIL PROTECTED] wrote:
Hello,
Here's my question.
Let's say I have the following numbers and I want to print them out so they
are formatted in money terms:
examples:
10834.00
1939432.00
to print out as:
$10,834.00
$1,939,432.00
How can I do this? I was suspecting that the
On 1/4/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Let's say I have the following numbers and I want to print them out so they
are formatted in money terms:
Have you seen this sub? It's from p. 184 of the llama book (Learning
Perl, 4th ed.).
sub big_money {
my $number = sprintf %.2f,
On Nov 29, Ing. Branislav Gerzo said:
I'd like to know if there is module for following:
Yes, Perl6::Form. It's a Perl 5 implementation of Perl 6's formats.
112
12345678901234567890
=== OUT ===
| This is just |
| small sentence |
| about nothing. |
=== OUT ===
So,
Jeff 'japhy' Pinyan [JP], on Tuesday, November 29, 2005 at 09:12
(-0500 (EST)) thoughtfully wrote the following:
I'd like to know if there is module for following:
JP Yes, Perl6::Form. It's a Perl 5 implementation of Perl 6's formats.
sometime is better ask, than DIY. Thanks a lot Japhy, this
Jeff 'japhy' Pinyan [JP], on Tuesday, November 29, 2005 at 09:12
(-0500 (EST)) wrote the following:
Jeff, Perl6::Form is so powerful. But I can't find how to properly do
this:
I have values:
('Name','Branislav');
('Surname','Gerzo');
And I'd like to print:
|Name: Branislav
Ing. Branislav Gerzo [IBG], on Tuesday, November 29, 2005 at 17:14
(+0100) wrote:
IBG And I'd like to print:
IBG |Name: Branislav |
IBG |Surname.: Gerzo |
IBG 26.^
Ryan Frantz wrote:
Perlers,
Is there are way to format a variable before placing it into an array or
hash? I have several variables that contain floating point numbers that
I format prior to printing out:
my $float = 12.3456;
print %2.1f\n, $float;
perldoc -f sprintf
-Original Message-
From: Wiggins d'Anconia [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 12, 2005 5:31 PM
To: Ryan Frantz
Cc: Perl Beginners List
Subject: Re: Formatting Variables
Ryan Frantz wrote:
Perlers,
Is there are way to format a variable before placing
On Mar 25, 2005, at 11:55 AM, Lawrence Statton wrote:
The simplest solution is to temporarily turn off autoEscape
Indeed it is. I'll try and remember this, again.
On Mar 25, 2005, at 11:55 AM, Charles K. Clarkson wrote:
I'm guessing that you have something like this somewhere.
use CGI
I'm trying to format the text used in my labels for a radio box group
created with CGI.pm... Among other things, I've tried:
I know there must be a way to do this and any help to get me over this
hump would be much appreciated.
The simplest solution is to temporarily turn off autoEscape
Ing. Branislav Gerzo wrote:
Hi all,
I have little formatting problem, we have code:
sub test {
$sth = $dbh-prepare_cached(SQL);
INSERT INTO table (ip, port, type, create_date)
VALUES (?,?,?,?)
SQL
$sth-execute('12.12.12.12', 80, proxy, '2002-12-12');
$sth-finish;
return;
}
this of
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
: Hi all,
:
: I have little formatting problem, we have code:
:
: sub test {
: $sth = $dbh-prepare_cached(SQL);
: INSERT INTO table (ip, port, type, create_date)
: VALUES (?,?,?,?)
: SQL
: $sth-execute('12.12.12.12', 80, proxy, '2002-12-12');
On Feb 11, 2004, at 2:55 PM, James Edward Gray II wrote:
[snip]
my @char = ( /[a-z]/ig, ( '-' ) x $len )[ 0 .. $len - 1 ];
If I may, yuck! This builds up a list of all the A-Za-z characters in
the string, adds a boat load of extra - characters, trims the whole
list to the length you want
On Feb 12, 2004, at 10:06 AM, Michael S. Robeson II wrote:
On Feb 11, 2004, at 2:55 PM, James Edward Gray II wrote:
[snip]
my @char = ( /[a-z]/ig, ( '-' ) x $len )[ 0 .. $len - 1 ];
If I may, yuck! This builds up a list of all the A-Za-z characters
in the string, adds a boat load of
(redirected to Perl Beginners by James)
On Feb 11, 2004, at 10:34 AM, Michael S. Robeson II wrote:
Hey, thanks again for the perl code.
You're welcome, but let's keep our discussion on the mailing list so we
can all help and learn.
However, I forgot to take into account that the original input
On Feb 11, 2004, at 1:27 PM, Michael S. Robeson II wrote:
[snip]
Anyway, though it works great I am having a tough time trying to
figure out WHY it works.
See comments below, in the code.
[snip]
I think if I can understand the mechanics behind this script it will
only help me my future
James Edward Gray II wrote:
$/ = ''; # Set input operator
Here's most of the magic.
Exactly. If you don't believe in magic, don't write in Perl:
most people don't.
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
See comments below.
On Feb 11, 2004, at 2:55 PM, James Edward Gray II wrote:
On Feb 11, 2004, at 1:27 PM, Michael S. Robeson II wrote:
[snip]
Anyway, though it works great I am having a tough time trying to
figure out WHY it works.
See comments below, in the code.
[snip]
I think if I can
On Feb 11, 2004, at 2:35 PM, Michael S. Robeson II wrote:
next unless s/^\s*(\S+)//;
my $name = $1;
Well, if we're reading name to name, the thing right a the beginning
of our sequence is going to be a name, right? The above removes the
name, and saves it for later use.
OK, I think
Roger Grosswiler wrote:
hi again, thanks to you, i got it with my date. so 1st point is out. i
still have a short problem, as i should get my date back in the format
ddmmyy and i get it in d m y (with %2d, but how to handle in vars)
How about
$lt2mday = sprintf(%02d, $lt2mday);
perldoc -f
Michael S. Robeson II wrote:
Hi I am all still to new to PERL and I am having trouble playing with
formatting my data into a new format. So here is my problem:
I have data (DNA sequence) in a file that looks like this:
# Infile
bob
AGTGATGCCGACG
fred
ACGCATATCGCAT
jon
On Feb 5, R. Joseph Newton said:
my $sequence_length = 20;
my $line = DATA;
chomp $line;
while ($line) {
my $sequence_tag = trim_line($line);
$line = DATA;
chomp $line;
my @nucleotides = split //, $line;
push @nucleotides, '_' for (1..($sequence_length - @nucleotides));
I'd be in
Michael S. Robeson II wrote:
Hi I am all still to new to PERL and I am having trouble playing with
formatting my data into a new format. So here is my problem:
I have data (DNA sequence) in a file that looks like this:
[snip]
Please don't talk about interesting stuff like DNA sequences on a
Michael S. Robeson II wrote:
I have data (DNA sequence) in a file that looks like this:
# Infile
bob
AGTGATGCCGACG
fred
ACGCATATCGCAT
jon
CAGTACGATTTATC
and I need it converted to:
# Outfile
R 1 20
A G U G A T G C C G A C G - - - - - - - bob
On Feb 4, Michael S. Robeson II said:
bob
AGTGATGCCGACG
fred
ACGCATATCGCAT
jon
CAGTACGATTTATC
R 1 20
A G U G A T G C C G A C G - - - - - - - bob
A C G C A U A U C G C A U - - - - - - - fred
C A G U A C G A U U U A U C - - - - - - jon
The R 1 is static and should
On Thu, 29 Jan 2004, Mallik wrote:
How do I format the decimals, i.e, if there is no
decimal part, then add .00, if there is one decimal,
then add '0'.
For eg., how to convert 123 to 123.00
and 123.5 to 123.50.
sprintf
Try this
-
Mallik wrote:
Dear Friends,
Hello,
How do I format the decimals, i.e, if there is no
decimal part, then add .00, if there is one decimal,
then add '0'.
For eg., how to convert 123 to 123.00
and 123.5 to 123.50.
printf %.2f\n, $_ for 123, 123.5;
John
--
use Perl;
program
fulfillment
Owen is dead on, but I think we can do that with less code. Try
something like:
printf (%0.2f\n, $_) while ();
Regards,
Adam
On Jan 29, 2004, at 5:25 AM, Owen Cook wrote:
On Thu, 29 Jan 2004, Mallik wrote:
How do I format the decimals, i.e, if there is no
decimal part, then add .00, if there
whenever you need to do any special formatting like this,
especially numbers, use the sprintf() in perlfunc - Perl
builtin functions for your case, try this:
print sprintf(%05.02f\n, 4.5 );
04.50
Why not just use 'printf()' for this? Makes it somewhat less confusing
while doing
Sara,
whenever you need to do any special formatting like this, especially
numbers,
use the sprintf() in perlfunc - Perl builtin functions
for your case, try this:
print sprintf(%05.02f\n, 4.5 );
04.50
there are 2 other print formatters: report and here documents.
I don't use the report method
Robert Citek wrote at Thu, 03 Jul 2003 18:48:02 -0500:
I want to format a number so that it has commas as a separator. Here's the
code I came up with:
my $num=12345678;
print scalar reverse( join(,, grep( /./ ,split
(/(...)/,reverse($num), \n;
This works but was wondering if anyone
From: Robert Citek [EMAIL PROTECTED]
Hello all,
I want to format a number so that it has commas as a separator.
Here's the code I came up with:
my $num=12345678;
print scalar reverse( join(,, grep( /./ ,split
(/(...)/,reverse($num), \n;
This works but was wondering if anyone
It was Thursday, July 03, 2003 when Robert Citek took the soap box, saying:
:
: Hello all,
:
: I want to format a number so that it has commas as a separator. Here's the
: code I came up with:
:
: my $num=12345678;
: print scalar reverse( join(,, grep( /./ ,split
: (/(...)/,reverse($num),
David Gilden wrote:
my (%bags_ordered,$bag);
# is it ok to mix match the type of variables inside a
# my vars declaration?
Does Perl tell you it isn't? Only thing to watch out for here is
combining list and scalar type variables during assignment.
@bags = param('handbag'); #CGI.pm
#!/usr/bin/perl -w
$num =1.12345;
my $tax_formated = sprintf(%.2f, $num); # --- THIS LINE
### $tax_formated is used in a few places
The important thing is, does it do what youo are expecting it to do?
Well yes, I think so. I wanted to cut down on the times I was calling
Have you tried using printf?
-Original Message-
From: Ramón Chávez [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 11, 2003 9:07 AM
To: [EMAIL PROTECTED]
Subject: Formatting Variables.
Hello boys and girls.
Is there a way to give format to a Variable.
I mean, if I don't want to get
See also 'sprintf' if you don't want to print the value, but assign it:
perldoc -f sprintf
perldoc -f printf
http://danconia.org
On Tue, 11 Feb 2003 09:09:55 -0500, Ken Lehman [EMAIL PROTECTED] wrote:
Have you tried using printf?
Thank you everyone.
sprintf is what I was looking for.
-rm-
- Original Message -
From: [EMAIL PROTECTED]
To: 'Ramón_Chávez' [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, February 11, 2003 8:30 AM
Subject: RE: Formatting Variables.
See also 'sprintf' if you don't want to print
Ramón Chávez wrote:
I mean, if I don't want to get printed 3.1415926535 (Or any irrational
number) but something like 3.14, is there a way to use format??
I agree with the other posts. Use printf. Here is some more reading, to check out:
perldoc -q long decimals
perldoc -q round
Hope this
On Tue, 11 Feb 2003 08:06:33 -0600, Rgíón «hávkú wrote:
Is there a way to give format to a Variable.
perldoc -f printf
I mean, if I don't want to get printed 3.1415926535 (Or any irrational
number) but something like 3.14, is there a way to use format??
perl -e 'printf %1.2f, 3.1415926535'
Wasn't really clear what I was trying to accomplish. Basically I am trying
to iterate through 2 hashes at the same time so I can print 1 key / value
pair from each hash on the same line. Repeating through each hash. Making
things more complicated I am forced to use perl4 with no libraries, so I
-Original Message-
From: Jensen Kenneth B SrA AFPC/DPDMPQ
[mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 26, 2002 9:46 AM
To: '[EMAIL PROTECTED]'
Subject: Formatting output
Accidentally sent before I was done writing.
I am trying to iterate through two hashes and print
Hi,
I'm going to take this from here, rather than go on to the full code, because I think
I see the core of the problem here. The foreach just isn't going to do it for what
you want, although you maight call it on one of the hashes. You don't really indicate
whether there is supposed to be
And sprintf(), format().
--
Bob Erinkveld (Webmaster Insane Hosts)
www.insane-hosts.net
MSN: [EMAIL PROTECTED]
From: Paul Kraus [EMAIL PROTECTED]
To: 'Mariusz' [EMAIL PROTECTED], 'perl' [EMAIL PROTECTED]
Subject: RE: formatting output
Date: Thu, 12 Dec 2002 07:59:54 -0500
tab is \t and space is normal space
*** REPLY SEPARATOR ***
On 12/11/02 at 11:45 PM Mariusz wrote:
I'm outputting lots of text into an email message. I would like to have
some basic control over the way how it is presented, but the only command
I know is \n - new line. What
Hope this is what you need
\r - return;
\t - tab
\f - form feed
\b - backspace
\a - bell
\e - escape
\007 - Any octal ASCII value ( here, 007 = bell )
\x7f - Any hex ASCII value ( here, 7f = delete )
..
...
From the
Llama Book
pg: 24
Narayan
On Wed, 11 Dec 2002, Mariusz wrote:
[EMAIL PROTECTED] wrote:
#Insert Date and Time
my $month = $mon00 #Two digit month
my $day = $mday00 #Two digit day in month
my $year = $year#Two digit year
??
my $hour = $hour00 #Two digit: Hour
my $min = $min00 #Two digit: Minutes
#Combine date and time above into MMDDYYHHmm
Gregg O'Donnell [EMAIL PROTECTED] writes:
I'm looking for the simplest way to use the date and time in the format of
MMDDYYHHmm (no spaces), which is used later in the program.
Here's what I've come up with; comments or suggestions are appreciated.
#Insert Date and Time
my $month =
-Original Message-
From: Gregg O'Donnell [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 13, 2002 9:14 AM
To: [EMAIL PROTECTED]
Subject: Formatting date, time
I'm looking for the simplest way to use the date and time in
the format of MMDDYYHHmm (no spaces), which is used later
-Original Message-
From: Bob Showalter [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 13, 2002 9:33 AM
To: 'Gregg O'Donnell'; [EMAIL PROTECTED]
Subject: RE: Formatting date, time
...
or, 2) Use the POSIX module's strftime(), which is simpler:
use POSIX 'strftime';
my
On Thu, 2002-06-20 at 22:42, Shishir K. Singh wrote:
Hi,
hi
I need to format a string in a fixed width field. The string may be less than the
length of the format, or may be greater. If less, then it should get padded with
spaces (left or right justified , like using - in sprintf), if
Shishir K. Singh wrote:
Hi,
Hello,
I need to format a string in a fixed width field. The string
may be less than the length of the format, or may be greater.
If less, then it should get padded with spaces (left or right
justified , like using - in sprintf), if greater, then the
string
Hi,
Hello,
I need to format a string in a fixed width field. The string
may be less than the length of the format, or may be greater.
If less, then it should get padded with spaces (left or right
justified , like using - in sprintf), if greater, then the
string should get truncated to
Shishir K. Singh wrote:
Thanks to Mark, John, David and Timothy!! I get the results if I use the
combination of
eg $myVar = 'ABCDEFGHIJKLMNOP';
$newVar = pack('A10',$myVar);
$newVar should have 'ABCDEFGHIJ'; # Works and faster than sprintf
eg $myVar = 'ABCD';
$newVar =
You can build the format string:
my $myVar = 'ABCD'; #(Left Aligned, padded with spaces)
#$newVar = sprintf(%-10s,$myVar);
#$newVar should have 'ABCD '; # Works
while ( 1 ) {
printf Left or Right: ;
chomp(my $MyInput = STDIN);
last if ( $MyInput =~ /^ex/i );
my $MySign
Try testing for the length of the string and then using the substr()
function to get the part that you want for strings that are longer than
desired.
-Original Message-
From: Shishir K. Singh
To: [EMAIL PROTECTED]
Sent: 6/20/02 10:42 PM
Subject: Formatting
Hi,
I need to format a
I want to format the output of my database query.
Current code
while (@row =$sth-fetchrow() ) {
print join(',',@row);
}
Results
1.38, .0396,.0076
Desired Results
1.38, 0.0396, 0.0076
Frank,
It's tough for me to be sure exactly what you are wanting for formatting, so I would
On Jun 13, Frank Newland said:
Results
1.38, .0396,.0076
Desired Results
1.38, 0.0396, 0.0076
$row[0] = sprintf(%04d,$row[2]); ## results in == 0.
$row[1] = sprintf(%0d.%04d,$row[4]); ## results in ==0.
%d is for INTEGERS. You have floating points, so use %f.
--
Jeff japhy
Frank Newland wrote:
I want to format the output of my database query.
Current code
while (@row =$sth-fetchrow() ) {
print join(',',@row);
}
Results
1.38, .0396,.0076
Desired Results
1.38, 0.0396, 0.0076
$ perl -le'print join , , map { sprintf %.4f, $_ } ( 1.38, .0396, .0076
On Friday, June 7, 2002, at 11:03 , Danial Magid wrote:
[..]
I am trying to put together a process that will format and print out
checks (pay stbus), so I need to do a bit of formatting and combine the
right fonts.
I was wondering if there are any books or urls I could use for reference.
Danial --
...and then Danial Magid said...
%
% Hi,
Hello!
%
% I am trying to put together a process that will format and print out
% checks (pay stbus), so I need to do a bit of formatting and combine the
% right fonts.
Who needs fonts? COURIER RUL3Z AND ASC11 IS DA B0MB, D00D! ;-)
%
%
Melissa Cama wrote at Wed, 29 May 2002 03:13:46 +0200:
...
I need to print out each value in the array (for each key) as a new line in an
excel/CSV file.
Also with each new line, a time stamp needs to be printed.
...
foreach $str_feature (%hash_FeatureUsers){
-Original Message-
From: Heiko Heggen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 29, 2002 5:48 AM
To: [EMAIL PROTECTED]
Subject: Formatting String output
Hi Guys.
I want to format my String output with the 'printf' command,
but I cant find
the solution. For you
Melissa Cama wrote:
Hi,
Hello,
I currently have a hash which has one value as the key, and then
an array of values assigned to this key. However the arrays are
different lengths.
I need to print out each value in the array (for each key) as a
new line in an excel/CSV file. Also with
I can't test these, but I think they will work. Play around with sprintf a
little bit. Don't forget to check out 'perldoc -f sprintf'.
383.3as 383.30
$var = sprintf(%3.2f,$var)
37492908 as 37 492 908
if($var 1 =~ /(\d{2})(\d{3})(\d{3})/){
$formattedvar = $1 $2
Pat wrote:
I have been through man printf, info printf and perldoc -f print and still
can't find how to format numbers.
In the program below I would like to print the numbers as below:
383.3as 383.30
$ perl -le'printf %.2f\n, 383.3'
383.30
37492908 as 37 492 908
If
On Tue, 2002-02-05 at 12:29, Hughes, Andrew wrote:
I have created a news article database where non-technical people can cut
and paste articles to be stored in a mySQL database table. Everything
works. However when I display these in a browser, I want to have p
class=whatever/p tags around
On Tue, 2002-02-05 at 12:29, Hughes, Andrew wrote:
I have created a news article database where non-technical people can cut
and paste articles to be stored in a mySQL database table. Everything
works. However when I display these in a browser, I want to have p
class=whatever/p tags around
On Wed, 9 Jan 2002, John W. Krahn wrote:
printf is based on the C language printf function and can be a bit
tricky. The format %-5s will not truncate a value longer than 5
characters but it will pad a shorter value with spaces. To truncate a
longer value use the format %-5.5s. Also, the
Cancel the request. The field coming in actually had 10 spaces in it, so
I just removed the spaces doing this:
$field14 = @fields[14];
$field14 =~ s/ //g;
print NEWQUOTES ($field14);
On Wed, 9 Jan 2002, Scott wrote:
printf NEWQUOTES (%-5s, @fields[14]);
When I run the code I get 10 extra
-Original Message-
From: Scott [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 09, 2002 10:29 AM
To: [EMAIL PROTECTED]
Subject: Formatting with printf
Hi all.
I have a couple of strings that I need to format. One of
those fields is
a alpha/numeric string. Here is
Scott wrote:
Hi all.
Hello,
I have a couple of strings that I need to format. One of those fields is
a alpha/numeric string. Here is the code:
printf NEWQUOTES (%-5s, @fields[14]);
When I run the code I get 10 extra spaces before the next field instead of
the 5. The value of
Hi,
# Define your fields
my($fld1, $fld2, $fld3, $fld4, $fld5, $fld6, $fld7, $fld8);
# load fields in array which are separated by pipe delimit
foreach $val1(@arr1) # referring to values in array
{($fld1, $fld2, $fld3, $fld4, $fld5, $fld6, $fld7, $fld8) =
split(/\|/,$val1);
# Print the
If you are on a unix system...you can just say diff file1 file2. On Windows
there is probably something comparable.
-Original Message-
From: Najamuddin, Junaid
To: [EMAIL PROTECTED]
Sent: 8/28/2001 9:18 AM
Subject: Formatting text
Hi,
Here is my script, I am comparing two txt files
Sorry I forgot about the platform
It is on Windows NT platform
thanks
-Original Message-
From: Gibbs Tanton - tgibbs [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 28, 2001 9:34 AM
To: 'Najamuddin, Junaid '; '[EMAIL PROTECTED] '
Subject: RE: Formatting text
If you are on a unix
] '
Subject: RE: Formatting text
If you are on a unix system...you can just say diff file1 file2. On
Windows
there is probably something comparable.
-Original Message-
From: Najamuddin, Junaid
To: [EMAIL PROTECTED]
Sent: 8/28/2001 9:18 AM
Subject: Formatting text
Hi,
Here is my script, I am
1 - 100 of 114 matches
Mail list logo