Re: formatting a list

2013-10-01 Thread Charles DeRykus
On Mon, Sep 30, 2013 at 7:43 AM, Rajeev Prasad wrote: > thank you Shawn. this works nicely for me. > > > -- > *From:* Shawn H Corey > *To:* beginners@perl.org > *Cc:* Rajeev Prasad > *Sent:* Saturday, September 28, 2013 8:49 AM > *Subj

Re: formatting a list

2013-09-30 Thread Rajeev Prasad
thank you Shawn. this works nicely for me. From: Shawn H Corey To: beginners@perl.org Cc: Rajeev Prasad Sent: Saturday, September 28, 2013 8:49 AM Subject: Re: formatting a list On Fri, 27 Sep 2013 22:59:01 -0700 (PDT) Rajeev Prasad wrote: > i w

Re: formatting a list

2013-09-28 Thread Shawn H Corey
On Fri, 27 Sep 2013 22:59:01 -0700 (PDT) Rajeev Prasad 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 sprintf to o

Re: formatting a list

2013-09-28 Thread Rob Dixon
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 each

Re: formatting a list

2013-09-28 Thread Rob Dixon
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 each

Re: formatting a list

2013-09-28 Thread Shlomi Fish
Hi Jing, On Sat, 28 Sep 2013 16:53:20 +0800 Logust Yu 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 won't handle traili

Re: formatting a list

2013-09-28 Thread Logust Yu
ofc it should be "sprintf"... 2013/9/28 Rajeev Prasad > 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

Re: formatting a list

2013-09-28 Thread Logust Yu
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 > hello, > > following is obtained by concatenating 3 values using an underscore to > produce a list: > > abc_12_4567 > xy4z_xtr4_sdf > PQRSDR_x

Re: formatting a list

2013-09-27 Thread Shlomi Fish
Hi Rajeev, On Fri, 27 Sep 2013 22:59:01 -0700 (PDT) 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 i

Re: Formatting Numbers

2012-02-12 Thread Mike Blezien
: 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. > >

Re: Formatting Numbers

2012-02-12 Thread Rob Dixon
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 thi

Re: Formatting Numbers

2012-02-12 Thread Shlomi Fish
Hi Mike, On Sun, 12 Feb 2012 10:14:42 -0600 "Mike Blezien" 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 this: > > 179,5

Re: Formatting Question

2008-09-16 Thread John W. Krahn
[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, h

Re: Formatting Question

2008-09-16 Thread Dermot
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 mont

Re: Formatting Question

2008-09-16 Thread Mr. Shawn H. Corey
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?

Re: Formatting output after search and replace

2008-04-29 Thread Chas. Owens
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 OUT,'

Re: formatting a string

2007-07-04 Thread Mumia W.
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 /vmfs/volum

RE: formatting a string

2007-07-03 Thread Prabu Ayyappan
PM To: Joseph L. 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','

RE: formatting a string

2007-07-03 Thread Joseph L. Casale
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 A

Re: formatting a string

2007-07-03 Thread Prabu Ayyappan
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 1.vmdk','/vmfs/volumes/467f06

Re: formatting a string

2007-07-03 Thread Tom Phoenix
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 followi

Re: Formatting/presenting regex

2007-01-03 Thread John W. Krahn
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+)# Commen

Re: Formatting/presenting regex

2007-01-03 Thread Wiggins d'Anconia
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

Re: Formatting Question

2006-01-04 Thread Tom Phoenix
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 "%.2

Re: Formatting Question

2006-01-04 Thread Jeremy Vinding
[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 "p

Re: formatting text

2005-11-29 Thread Brano Gerzo
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.^

Re: formatting text

2005-11-29 Thread Ing. Branislav Gerzo
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

Re: formatting text

2005-11-29 Thread Ing. Branislav Gerzo
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, thi

Re: formatting text

2005-11-29 Thread Jeff 'japhy' Pinyan
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, I

RE: Formatting Variables

2005-10-12 Thread Ryan Frantz
> -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, > > > >

Re: Formatting Variables

2005-10-12 Thread Wiggins d'Anconia
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; > perld

RE: formatting problem

2004-10-30 Thread Charles K. Clarkson
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: : Hi all, : : I have little formatting problem, we have code: : : sub test { : $sth = $dbh->prepare_cached(finish; : return; : } Don't use a HERE doc and pass $dbh into the subrout

Re: formatting problem

2004-10-30 Thread Bob Showalter
Ing. Branislav Gerzo wrote: Hi all, I have little formatting problem, we have code: sub test { $sth = $dbh->prepare_cached(finish; return; } this of course doesn't work, because SQL is not at begining of the line. I tried: $sth = $dbh-

Re: formatting the loop

2004-02-12 Thread James Edward Gray II
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 extra

Re: formatting the loop

2004-02-12 Thread Michael S. Robeson II
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

Re: formatting the loop

2004-02-11 Thread James Edward Gray II
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 this

Re: formatting the loop

2004-02-11 Thread Michael S. Robeson II
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 und

Re: formatting the loop

2004-02-11 Thread Rob Dixon
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]

Re: formatting the loop

2004-02-11 Thread James Edward Gray II
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 unders

Re: formatting and syntax

2004-02-11 Thread James Edward Gray II
(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

Re: Formatting output

2004-02-10 Thread Jan Eden
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); perldo

Re: formatting and syntax

2004-02-05 Thread Jeff 'japhy' Pinyan
On Feb 5, R. Joseph Newton said: >my $sequence_length = 20; >my $line = ; >chomp $line; >while ($line) { > my $sequence_tag = trim_line($line); > $line = ; > chomp $line; > my @nucleotides = split //, $line; > push @nucleotides, '_' for (1..($sequence_length - @nucleotides)); I'd be in

Re: formatting and syntax

2004-02-05 Thread R. Joseph Newton
"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 > ACGCATA

Re: formatting and syntax

2004-02-04 Thread Jeff 'japhy' Pinyan
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 sta

Re: formatting and syntax

2004-02-04 Thread James Edward Gray II
On Feb 4, 2004, at 11:35 AM, 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 ACG

Re: formatting and syntax

2004-02-04 Thread david
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 -

Re: formatting and syntax

2004-02-04 Thread Rob Dixon
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 o

Re: Formatting the decimals

2004-01-29 Thread Adam
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 th

Re: Formatting the decimals

2004-01-29 Thread John W. Krahn
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 fu

Re: Formatting the decimals

2004-01-29 Thread Owen Cook
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 - #!

Re: formatting a number

2003-07-04 Thread Jenda Krynicky
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

Re: formatting a number

2003-07-04 Thread Janek Schleicher
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 wonderin

Re: formatting a number

2003-07-03 Thread Casey West
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),

Re: Formatting Variables.

2003-02-11 Thread Janek Schleicher
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.14159265

RE: Formatting Variables.

2003-02-11 Thread Westgate, Jared
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 t

RE: Formatting Variables.

2003-02-11 Thread Ramón Chávez
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 a

RE: Formatting Variables.

2003-02-11 Thread wiggins
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? > > -O

RE: Formatting Variables.

2003-02-11 Thread Ken Lehman
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

Re: Formatting output

2002-12-26 Thread R. Joseph Newton
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 an

RE: Formatting output

2002-12-26 Thread Bob Showalter
> -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 a

RE: Formatting output

2002-12-26 Thread Jensen Kenneth B SrA AFPC/DPDMPQ
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 can

RE: formatting output

2002-12-12 Thread Mystik Gotan
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 PROTEC

RE: formatting output

2002-12-12 Thread Paul Kraus
Also look up function printf. > -Original Message- > From: Mariusz [mailto:[EMAIL PROTECTED]] > Sent: Thursday, December 12, 2002 12:46 AM > To: perl > Subject: formatting output > > > I'm outputting lots of text into an email message. I would > like to have some basic control over the

Re: formatting output

2002-12-11 Thread Narayan Kumar
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 w

Re: formatting output

2002-12-11 Thread bansidhar
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. Wha

RE: Formatting date, time

2002-08-13 Thread Bob Showalter
> -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(), w

RE: Formatting date, time

2002-08-13 Thread Bob Showalter
> -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

Re: Formatting date, time

2002-08-13 Thread Robin Norwood
"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 >

Re: Formatting date, time

2002-08-13 Thread Tor Hildrum
<[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 MMD

Re: Formatting

2002-06-21 Thread John W. Krahn
"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 =

RE: Formatting

2002-06-21 Thread Shishir K. Singh
> > 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 truncat

Re: Formatting

2002-06-21 Thread John W. Krahn
"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 >

Re: Formatting

2002-06-20 Thread Marco Antonio Valenzuela Escárcega
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

RE: Formatting

2002-06-20 Thread Timothy Johnson
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 stri

RE: Formatting

2002-06-20 Thread David . Wagner
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 "eft or ight: "; chomp(my $MyInput = ); last if ( $MyInput =~ /^ex/i ); my $MySign = '-'

Re: Formatting output

2002-06-13 Thread John W. Krahn
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

Re: Formatting output

2002-06-13 Thread Jeff 'japhy' Pinyan
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. -- Jef

Re: Formatting output

2002-06-13 Thread Ovid
> 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

Re: Formatting in perl

2002-06-09 Thread drieux
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 referen

Re: Formatting in perl

2002-06-07 Thread David T-G
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! ;-) % %

RE: Formatting String output

2002-05-29 Thread Bob Showalter
> -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

Re: Formatting Output

2002-05-29 Thread Janek Schleicher
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){

Re: Formatting Output

2002-05-28 Thread John W. Krahn
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. Al

Re: formatting numbers

2002-04-29 Thread John W. Krahn
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 90

RE: formatting numbers

2002-04-28 Thread Timothy Johnson
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 $

Re: formatting database text

2002-02-05 Thread Chas Owens
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 class="whatever"> tags around

Re: formatting database text

2002-02-05 Thread Chas Owens
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 class="whatever"> tags around

Re: Formatting with printf

2002-01-10 Thread Scott
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,

Re: Formatting with printf

2002-01-09 Thread John W. Krahn
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

RE: Formatting with printf

2002-01-09 Thread Bob Showalter
> -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 strin

Re: Formatting with printf

2002-01-09 Thread Scott
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 extr

RE: formatting text

2001-09-19 Thread Najamuddin, Junaid
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 th

Re: Formatting text

2001-08-28 Thread Randal L. Schwartz
> "Mike" == Mike Rapuano <[EMAIL PROTECTED]> writes: Mike> I was searching for a diff-like perl tool for NT and came Mike> accross this persons code. Worked well for me. You might look at Algorithm::Diff, and especially the magazine column I wrote on that. The advantage over the [snipped] c

Re: Formatting text

2001-08-28 Thread Aravindan . Sundaram
Hope you have a file which contains these lines, Just check below code : $File = "sample.txt"; open(IN,"<$File"); while() { $_ =~ s/\x0d//g; if( $_ =~ m/play/i ) { $Result = ""; while( $_ =~ /.{0,5}play.{0,5}/i ) { $Result .= $`;

RE: Formatting text

2001-08-28 Thread Mike Rapuano
EMAIL PROTECTED] ' 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, Her

RE: Formatting text

2001-08-28 Thread Najamuddin, Junaid
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

RE: Formatting text

2001-08-28 Thread Gibbs Tanton - tgibbs
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 whi

Re: Formatting text

2001-08-24 Thread Curtis Poe
--- Michael Fowler <[EMAIL PROTECTED]> wrote: > On Fri, Aug 24, 2001 at 12:23:17PM -0700, Curtis Poe wrote: > > --- [EMAIL PROTECTED] wrote: > > This is such a common problem that "use strict 'system'" is being > > considered for Perl 6. > > Hm, I don't remember any discussion on that one, but pe

Re: Formatting text

2001-08-24 Thread Michael Fowler
On Fri, Aug 24, 2001 at 12:23:17PM -0700, Curtis Poe wrote: > --- [EMAIL PROTECTED] wrote: > This is such a common problem that "use strict 'system'" is being > considered for Perl 6. Hm, I don't remember any discussion on that one, but perhaps I missed something. Regardless, you don't need to w

RE: Formatting text

2001-08-24 Thread Curtis Poe
--- [EMAIL PROTECTED] wrote: > This is going off of two assumptions, 1) that you want the task number to be > unique and 2) the fields are supposed to be tab delimited. If you want to > remove the dups from a different column then make that column as the key to > the hash. As for which fields, you

  1   2   >