Formatting output

2002-06-13 Thread Frank Newland
All, 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 Here's what I've tried.. but none of these formats appear $row[0] = sprintf("%04d",$row[2]); ##

Modulus and Quotient

2002-05-04 Thread Frank Newland
Folks, What, if any, is the perl operator which returns just the integer portion of a quotient? Also known as modulo's sidekick. e.g. $remainder = 2002 % 100 ; ## $remainder = 2 $complete_quotient = 2002/100 ## $complete_quotient = 20.02 $whole_number= 2002 (what operator) /100 ## so tha

Finding last record without slurping.

2002-05-02 Thread Frank Newland
Ladies and Gentlemen: I'm using a while loop to search for specific record. If I find the record, then I need to report that record and the trailer record. I'm not slurping the file into memory so I can't use $openfile[$#openfile] approach. Here's what I have: while () { if (/searchpattern/)

Logic rewrite help...

2002-02-22 Thread Frank Newland
Quick help pls.. I want to use only 'and' statements. How can I get rid of this OR ?? My Boolean algebra is not functional at the moment... where ((A) or (not B ) ) TIA.. Frank -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Insert delimiter between number and alpha

2002-02-07 Thread Frank Newland
All, My input looks like this == 5544#1341343BORIS 6200#321BOWSER 89232652#6213VERONICA === I want to put a delimiter (#) between the rightmost number and the left most alpha Resulting in 5544#1341343#BORIS 6200#321#BOWSER 89232652#6213#VERONICA Any

perldoc -f localtime: What is (localtime)[8] ??

2002-01-15 Thread Frank Newland
perldoc -f localtime returns # 0 12 3 4 5 678 ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =localtime(time); What is $isdst??? Thanks, Frank -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [E

Array output

2002-01-10 Thread Frank Newland
Readers: I'm running a query on a list (input file) and capturing the first column of the results to an array. When I print the array, the first element is null why is this ?? There are 5 items in my list, 6 rows of output. My goal is to do more processing on @skulisting (which requires not havi

substr and =~ as one liner

2001-11-27 Thread Frank Newland
How can I express the following two lines as a one liner? === $left_trim = substr($_,85,13); $left_trim =~ s/^\s+// ; ## Remove leading spaces === tia frank -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Off-Topic (200%) - Where are you from?

2001-11-09 Thread Frank Newland
Opelika, Alabama.. North of Beauregard, East of Lochapoka, South of Buffalo, West of Bleecker -Original Message- From: Etienne Marcotte [mailto:[EMAIL PROTECTED]] Sent: Friday, November 09, 2001 9:08 AM To: [EMAIL PROTECTED] Subject: Off-Topic (200%) - Where are you from? By reading t

Regex syntax

2001-10-31 Thread Frank Newland
Hey, On an Oct 25 thread, someone asked how to remove trailing spaces. The response was $Value =~ s/\s+$//. Question. 1. The string upon which this operation was made is on $_ correct? 2. If I've made the assignment $tempstring = substr($_ ,0,20) how do I remove trailing spaces from $tempstring

Math::BigInt

2001-10-29 Thread Frank Newland
Readers, I've been to cpan.org site but some of the pages are not appearing. what does Math::BigInt do in the following perl line? $amount= Math::BigInt ->new("$posted_amount"); tia, Frank -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Perl equivalent to awk's 'getline'

2001-08-09 Thread Frank Newland
Readers: awk has a function called 'getline' which reads the next line of input without changing control of the script. My input file contains pairs of records. When I find a record that matches my search pattern, I want that record and the next record. In awk, I used the 'getline' which did ju

Destroying Database Handle

2001-07-30 Thread Frank Newland
Question about DBI I'm having success in preparing , executing and getting SQL output when I use DBI. What I want to do is ensure that I close properly. Q: What statement(s) do I need to prevent destroying database handle? Thanks, Frank *** #!/usr/bin/perl -w use stric

Pipe usage

2001-07-26 Thread Frank Newland
I want to print the contents of an archived file. When I run this script, all it does is uncompress my file. Q: 1. Isn't CONTENTS a file handle to the uncompressed file? 2. Why doesn't perl execute my while statement? 3. What should I do to print the contents of an archived file?

Time-out

2001-07-25 Thread Frank Newland
A Perl 5 liner... ** Schwartz et al's books as you know Get praises like one's listed below "The Leopard's divine", or "The Camel's much finer" But the Llama is numero uno!! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMA

RE: sed to perl

2001-07-19 Thread Frank Newland
from Ed McMahon... Thanks Paul, Paul, and Randall for the feedback... Frank -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 19, 2001 1:21 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: sed to perl >>>>> "Frank" ==

sed to perl

2001-07-19 Thread Frank Newland
I want to use perl to do what I can't do on large files with sed. 1. I run the following Unix command: $prompt> sed -f list_of_changes original > outputfile 2. Extract of list_of_changes: s/KAREN/LAURA /g s/KARA/MONA/g s/MIKE/OMAR/g s/BOB/TOM/g ... 3. The file list_of_changes contains 6

Trailing spaces ... aka rtrim();

2001-06-28 Thread Frank Newland
All, I wish to remove trailing spaces.. #!/usr/bin/perl -w use strict ; my $line ; while (<>) { chomp $_ ; $line =~ s/\s+$//; # remove trailing spaces print " $line \n"; } My output is equal number of blank lines.. Where is my error? Frank