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]); ##
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
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/)
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]
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 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
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
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]
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
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
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]
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
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
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?
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
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" ==
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
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
18 matches
Mail list logo