Re: How to get fields from a SQL DB one by one

2003-10-14 Thread simran
this (the method below) is database dependent, i use it with postgres: sub getFieldNames { my $dbh = new DBI(...) my $sth = $dbh->prepare("SELECT * FROM $table WHERE 1=0"); $sth->execute; # # Get all the field names (execlue the field's we were asked to exclude) and return..

How to get fields from a SQL DB one by one

2003-10-14 Thread ramakrishna
Hi, Can any one tell me How to get fields from a SQL Database. I need to get each field separately. Thanks in advance, Ramakrishna.S

Re: Another sub clean up

2003-10-14 Thread Sudarshan Raghavan
Sudarshan Raghavan wrote: > simran wrote: > > > I wrote my self this subroutine... which comes in very handy :-) > > > > ..snip > > > > sub strip { > > my $self = shift; > > my $ref = shift; > > > > if (! ref($ref)) { > > $ref =~ s/(^[\s\t]*)|([\s\t]*$)//g if (defined $ref); > > Why is

Re: Another sub clean up

2003-10-14 Thread Sudarshan Raghavan
simran wrote: > I wrote my self this subroutine... which comes in very handy :-) > > ..snip > > sub strip { > my $self = shift; > my $ref = shift; > > if (! ref($ref)) { > $ref =~ s/(^[\s\t]*)|([\s\t]*$)//g if (defined $ref); Why is it better to do this in two steps? Read through this

Re: Another sub clean up

2003-10-14 Thread simran
I wrote my self this subroutine... which comes in very handy :-) # # strip # =head2 strip =over =item Description Strips out leading and training whitespaces from references... =item Input * Reference to an array, hash or string or A string =item Return * If input was a refer

Re: Another sub clean up

2003-10-14 Thread Sudarshan Raghavan
[EMAIL PROTECTED] wrote: > Can someone hlpe me clean up this trim? > > Rule: remove all trailing blanks and newline/LF perldoc -q 'How do I strip blank space from the beginning/end of a string' > > > Do I need a chomp here somewhere? No, the \s+ will take care of that > > > sub trim > { my $

Re: Help w/Class::Date Date.xs

2003-10-14 Thread perl
> [panda]$ perl -MDate::Class -le 'print $INC{"Date/Class.pm"}' Do you think you meant this? > [panda]$ perl -MClass::Date -le 'print $INC{"Class/Date.pm"}' thanks --- > [EMAIL PROTECTED] wrote: > >> I downloaded the tar file. But I couldn't find out how to install it >> from >

Re: Help w/Class::Date Date.xs

2003-10-14 Thread perl
Your response is great! Being new to the environment, simple and fundamental things can be frustrating. Your step-by-step instruction not only made it possible to install but it gave me a clue into understanding how the perl/cpan are structured/organized. I just have a follow-up question. Is thi

RE: Help w/Class::Date Date.xs

2003-10-14 Thread perl
fyi, I'm on the redhat linux. Well ths this the first I saw about Date::Calc. In any case, I have a pretty straight forward requirements and will ask you or anyone familiar dates for recommendation. Taking into consideration my requirements, what is the best date modules available that you can reco

RE: Help w/Class::Date Date.xs

2003-10-14 Thread Tristram Nefzger
Hi, I suggest always taking a glance at the documentation that comes with the module. Most of that should be in the perldoc, so for Class::Date you can run "perldoc Class::Date". Sometimes it is useful also to look in the source directory at the README and INSTALL files and examples if any. I p

Another sub clean up

2003-10-14 Thread perl
Can someone hlpe me clean up this trim? Rule: remove all trailing blanks and newline/LF Do I need a chomp here somewhere? sub trim { my $z = $_[0]; $z =~ s/^\s+//; $z =~ s/\s+$//; return $z; } thanks, -rkl - eMail solutions by http://www.swanma

RE: Help w/Class::Date Date.xs

2003-10-14 Thread perl
THanks alot for the install info. But I would like your opinion for the following questions: 1 - Do you think that it will work without installing the XS? It seems to be working fine but it is giving me a warning message all the time. 2 - DO I need to worry about it messing anything (kernel/perl

Re: clean up sub?

2003-10-14 Thread perl
Great stuff everyone! Some of it is still greek to me ;) here's what I got to work for me: #!/usr/bin/perl my $a="aBe"; my $b="bOb"; my $c="cAb"; aUpper($a); bUpper($b); cUpper($c); print $a . " " . $b . " " . $c . "\n"; #results #These sub below are good: sub aUpper { return $_[0] = uc($_[0

Re: clean up sub?

2003-10-14 Thread perl
I like that - lc() and uc() Hmm... I wonder why it is not in the orielly book? thanks, -rkl > On Tuesday, October 14, 2003, at 05:59 PM, [EMAIL PROTECTED] wrote: > >> Can someone shorten this upper routine? >> >> sub toUpper >> { my $z = shift; >> $z =~ tr/a-z/A-Z/; >> return $z; >> } > > Yes,

Re: clean up sub?

2003-10-14 Thread John W. Krahn
Daniel Staal wrote: > > --On Tuesday, October 14, 2003 15:59 -0700 "[EMAIL PROTECTED]" > <[EMAIL PROTECTED]> wrote: > > > > Also in a slightly different scenario, how can i change the value > > of the parameter itself with a sub. > > > > $a="ca"; > > toUpper($a); #change the $a value itself > > p

Re: clean up sub?

2003-10-14 Thread Steve Grazzini
On Tue, Oct 14, 2003 at 06:24:07PM -0500, Daniel Staal wrote: > --On Tuesday, October 14, 2003 15:59 -0700 "[EMAIL PROTECTED]" > >Also in a slightly different scenario, how can i change the value > >of the parameter itself with a sub. > > > >$a="ca"; > >toUpper($a); #change the $a value itself >

Re: clean up sub?

2003-10-14 Thread John W. Krahn
David --- Senior Programmer Analyst --- Wgo Wagner wrote: > > [EMAIL PROTECTED] wrote: > > Can someone shorten this upper routine? > > > > sub toUpper > > { my $z = shift; > > $z =~ tr/a-z/A-Z/; > > return $z; > > } > $_[0] =~ tr/a-z/A-Z/; > 1; Why are you returning 1? John --

RE: Help w/Class::Date Date.xs

2003-10-14 Thread Tristram Nefzger
Hi, I just took a look at this. After downloading and unbundling Class-Datge-1.1.7.tar.gz I found the Date.xs file that you mentioned. There was no INSTALL file so I did the following: perl Makefile.PL # builds Makefile in which Date.xs is referenced make make install # no "test" target in th

Re: clean up sub?

2003-10-14 Thread Daniel Staal
--On Tuesday, October 14, 2003 15:59 -0700 "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: Can someone shorten this upper routine? sub toUpper { my $z = shift; $z =~ tr/a-z/A-Z/; return $z; } Sure: sub toUpper { $_[0] =~ tr/a-z/A-Z/; } or sub toUpper { "\U$_[0]"; } I wouldn't write a function f

Re: working on time

2003-10-14 Thread David Wall
--On Monday, October 13, 2003 1:34 PM -0700 Jorge Barrios <[EMAIL PROTECTED]> wrote: [EMAIL PROTECTED] (Mark Lobue) writes: > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > It's fair enough to use 86,400 sec in a day. But what about > adding days or Adding days is simply adding multiple

Re: Help w/Class::Date Date.xs

2003-10-14 Thread david
[EMAIL PROTECTED] wrote: > I downloaded the tar file. But I couldn't find out how to install it from > the README. From the various info in the readme I was able to install the > .pm files but not the xs. The Date class look like it's working but it > keeps showing the message about the XS part wa

Re: clean up sub?

2003-10-14 Thread Steve Grazzini
On Tue, Oct 14, 2003 at 06:38:40PM -0400, Steve Grazzini wrote: > On Tue, Oct 14, 2003 at 03:59:16PM -0700, [EMAIL PROTECTED] wrote: > > Can someone shorten this upper routine? > > > > sub toUpper > > { my $z = shift; > > $z =~ tr/a-z/A-Z/; > > return $z; > > } > > sub to_upper { uc shift }

Re: clean up sub?

2003-10-14 Thread John W. Krahn
[EMAIL PROTECTED] wrote: > > Can someone shorten this upper routine? > > sub toUpper > { my $z = shift; > $z =~ tr/a-z/A-Z/; > return $z; > } sub toUpper { uc shift } > Also in a slightly different scenario, how can i change the value of the > parameter itself with a sub. > > $a="ca"; > toUp

Re: clean up sub?

2003-10-14 Thread James Edward Gray II
On Tuesday, October 14, 2003, at 05:59 PM, [EMAIL PROTECTED] wrote: Can someone shorten this upper routine? sub toUpper { my $z = shift; $z =~ tr/a-z/A-Z/; return $z; } Yes, I can. Replace wall calls of toUpper() with uc(). ;) James -- To unsubscribe, e-mail: [EMAIL PROTECTED] For addition

Re: clean up sub?

2003-10-14 Thread Steve Grazzini
On Tue, Oct 14, 2003 at 03:59:16PM -0700, [EMAIL PROTECTED] wrote: > Can someone shorten this upper routine? > > sub toUpper > { my $z = shift; > $z =~ tr/a-z/A-Z/; > return $z; > } sub to_upper { uc shift } > Also in a slightly different scenario, how can i change the value of the > paramet

RE: clean up sub?

2003-10-14 Thread Wagner, David --- Senior Programmer Analyst --- WGO
[EMAIL PROTECTED] wrote: > Can someone shorten this upper routine? > > sub toUpper > { my $z = shift; > $z =~ tr/a-z/A-Z/; > return $z; > } $_[0] =~ tr/a-z/A-Z/; 1; > > Also in a slightly different scenario, how can i change the value of > the parameter itself with a sub. > > $

Re: Help w/Class::Date Date.xs

2003-10-14 Thread Daniel Staal
--On Tuesday, October 14, 2003 15:49 -0700 "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: I downloaded the tar file. But I couldn't find out how to install it from the README. From the various info in the readme I was able to install the .pm files but not the xs. The Date class look like it's wor

clean up sub?

2003-10-14 Thread perl
Can someone shorten this upper routine? sub toUpper { my $z = shift; $z =~ tr/a-z/A-Z/; return $z; } Also in a slightly different scenario, how can i change the value of the parameter itself with a sub. $a="ca"; toUpper($a); #change the $a value itself print $a; #I want it to print "CA"

Re: Help w/Class::Date Date.xs

2003-10-14 Thread perl
I downloaded the tar file. But I couldn't find out how to install it from the README. From the various info in the readme I was able to install the .pm files but not the xs. The Date class look like it's working but it keeps showing the message about the XS part warning. The Date.xs is sitting in m

Re: Which action button clicked?

2003-10-14 Thread perl
thanks > On Tue, 14 Oct 2003 02:35:02 -0700, perl wrote: >> Can someone show me how to determine which button the user clicked? > > This hasn't all that much to do with Perl, really. > >> >> > > Name your input fields. For example something like this: > > > > > Now, in your script: > >

Re: Which action button clicked?

2003-10-14 Thread Tore Aursand
On Tue, 14 Oct 2003 02:35:02 -0700, perl wrote: > Can someone show me how to determine which button the user clicked? This hasn't all that much to do with Perl, really. > > Name your input fields. For example something like this: Now, in your script: my $direction = $cgi->param( 'd

Re: Perl 5.8.1 and Installing Modules

2003-10-14 Thread Adam Gent
Hi, I reinstalled Perl and it all seems to work fine now.. Thanks, Adam - Original Message - From: "Tristram Nefzger" <[EMAIL PROTECTED]> To: "'Adam Gent'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, October 14, 2003 8:17 PM Subject: RE: Perl 5.8.1 and Installing Modules

RE: Perl 5.8.1 and Installing Modules

2003-10-14 Thread Tristram Nefzger
Hi, Sorry I don't have 5.8.1 yet. Someone who does should field this issue in detail. From what you've written, I suggest taking a look in the 5.8.0 directories to see if HTML::Template is there. Sometimes an installation does not work if the target directories don't exist beforehand, so it may

Re: How to glue Net::Server and readline ?

2003-10-14 Thread Steve Grazzini
On Tue, Oct 14, 2003 at 08:19:12PM +0200, Ernest Beinrohr wrote: > Hi, I'm trying to glue together an console application with readline > extension (=I can edit the line befor I enter it). How can I make it > work with Net::Server ? > > The readline package is "running" on the server size, altho

Re: Perl 5.8.1 and Installing Modules

2003-10-14 Thread Adam Gent
Hi, One of the modules that I am trying to install is HTML::Template, but I have also tried many others. I am installing the modules through the CPAN shell. In 5.8.0 it installed into /site_perl/5.8.0/HTML::Template But no sign of it under 5.8.1 Adam - Original Message - From: "T

RE: Perl 5.8.1 and Installing Modules

2003-10-14 Thread Tristram Nefzger
There is normally a sign of an installed module. I've found that sometimes it is buried as a submodule in an existing hierarchy. But how are you installing the modules, and what is one module that you installed, preferably one without additional non-core module dependencies? -tristram -- To

Perl 5.8.1 and Installing Modules

2003-10-14 Thread Adam Gent
Hi All, I have just installed Perl 5.8.1 and am trying to install some modules via CPAN. When I install the module, it always says that it has installed it correctly. But when I come to use it, it can not be found. There is also no sign of module on the hard drive. In perl 5.8.0 it would insta

How to glue Net::Server and readline ?

2003-10-14 Thread Ernest Beinrohr
Hi, I'm trying to glue together an console application with readline extension (=I can edit the line befor I enter it). How can I make it work with Net::Server ? The readline package is "running" on the server size, although it should run on the client side after he telnets to a port. -- Ernes

Re: Help w/Class::Date Date.xs

2003-10-14 Thread david
[EMAIL PROTECTED] wrote: > Can someone help me with where to put the Date.xs file? > > I just downloaded the Class-Date-1.1.7.tar.gz. > > I figured out where to put the 2 files in /usr/lib/perl5/5.8.0/Class: > - Class::Date.pm > - Class::Date::Const.pm > > - Date.xs -where shoud it go? > > I r

Re: [PBML] How do I convert strings to floating number?

2003-10-14 Thread Randal L. Schwartz
> "Marcus" == Marcus Claesson <[EMAIL PROTECTED]> writes: Marcus> while (<>) { Marcus> chomp; Marcus> if ($_ lt 1e-50) { Don't use "lt" for numbers. Use "<". -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <[EMAIL PROTECTED]> http://www.stonehenge.com

Re: adding an array as a hash value

2003-10-14 Thread Rob Dixon
Hi Dermot. Dermot Paikkos wrote: > > I am trying to create a hash and one element is an array. The hash > comes from a csv file. > > I use $/ = ",\"\"\n" because there is a new line in each record. The > first 4 elements of each record are always the same and these are > easily assigned to the ha

Re: Which action button clicked?

2003-10-14 Thread James Edward Gray II
On Tuesday, October 14, 2003, at 04:35 AM, [EMAIL PROTECTED] wrote: Can someone show me how to determine which button the user clicked? This is an HTML question. You would probably have better luck with these kinds of things if you asked HTML, or even CGI, groups. use CGI; $cgi->param did not

RE: How do I convert strings to floating number?

2003-10-14 Thread Bob Showalter
Marcus Claesson wrote: > > lt, gt etc. are used for string comparisons. Change 'lt' to < and > > 'gt' to > and your code should work. > > > > You're right, but this script was a simplification of a > bigger one where > '>' didn't work (my mistake to not spot the difference...). Here is a > more

Re: How do I convert strings to floating number?

2003-10-14 Thread Sudarshan Raghavan
Marcus Claesson wrote: > > lt, gt etc. are used for string comparisons. Change 'lt' to < and 'gt' to > > > and your code should work. > > > > You're right, but this script was a simplification of a bigger one where > '>' didn't work (my mistake to not spot the difference...). Here is a > more 'rea

Re: Is there a better way to?

2003-10-14 Thread Rob Dixon
Christopher Lyon wrote: > > From: simran [mailto:[EMAIL PROTECTED] > > > > On Tue, 2003-10-14 at 13:59, Christopher Lyon wrote: > > > > > I have a line of text that I want to pull an e-mail address > > > out from. Is this the best way to pull that information from > > > that line? > > > > > > > >

Re: sort w/o using an array

2003-10-14 Thread Rob Dixon
John W. Krahn wrote: > > John Fisher wrote: > > > > I am trying to figure out if there is a way to do a sort that > > doesn't involve putting an entire file in memory. This kind of > > thing is available in apps like syncsort, where you give it > > arguments and it uses disk space/virtual memory t

Re: How do I convert strings to floating number?

2003-10-14 Thread Paul Johnson
Marcus Claesson said: > Hi there, > > I have a simple problem that I'm sure has been asked before (so why not > again ;)) > > I have a list like this: > > 1e-100 > 2e-100 > 1e-45 > 5e-10 > 1 > 10 > 20 > > and want to make correct assignments: > > 1e-100SMALL > 2e-100SMALL > 1e-45 B

Re: How do I convert strings to floating number?

2003-10-14 Thread Marcus Claesson
> lt, gt etc. are used for string comparisons. Change 'lt' to < and 'gt' to > > and your code should work. > You're right, but this script was a simplification of a bigger one where '>' didn't work (my mistake to not spot the difference...). Here is a more 'real' situation: Input file: 4635a

Re: How do I convert strings to floating number?

2003-10-14 Thread Sudarshan Raghavan
Marcus Claesson wrote: > Hi there, > > I have a simple problem that I'm sure has been asked before (so why not > again ;)) > > I have a list like this: > > 1e-100 > 2e-100 > 1e-45 > 5e-10 > 1 > 10 > 20 > > and want to make correct assignments: > > 1e-100 SMALL > 2e-100 SMALL > 1e-45 BIGGER > 5

adding an array as a hash value

2003-10-14 Thread Dermot Paikkos
Hi, I am trying to create a hash and one element is an array. The hash comes from a csv file. I use $/ = ",\"\"\n" because there is a new line in each record. The first 4 elements of each record are always the same and these are easily assigned to the hash. After that there are 20 other fields (

How do I convert strings to floating number?

2003-10-14 Thread Marcus Claesson
Hi there, I have a simple problem that I'm sure has been asked before (so why not again ;)) I have a list like this: 1e-100 2e-100 1e-45 5e-10 1 10 20 and want to make correct assignments: 1e-100 SMALL 2e-100 SMALL 1e-45 BIGGER 5e-10 BIGGER 1 BIGGER 10 BIG 20 BIG But wit

Re: help float to string

2003-10-14 Thread Paul Johnson
[EMAIL PROTECTED] said: > Can someone help me with retaining the precisions when they are zero? > > ie - > > $f = 9.00 > $z = $f; > print $z; #result in 9 - bad I want 9.00 > > $fx = 9.25 > $z = $fx; > print $z; #result in 9.25 - good > > I can but don't want to use a sub like itoa. Why not? Se

Re: array inside an array

2003-10-14 Thread Jorge Barrios
[EMAIL PROTECTED] (Guruguhan N) writes: > Hi All, > I have recently started using Perl for my project. I have a problem in > getting elements of the following array. > > @array1 = ( [ x1, x2, x3], > [ x4, x5, x6], > [ x7, x8, x9]); > > I would like to get the el

Re: working on time

2003-10-14 Thread Jorge Barrios
[EMAIL PROTECTED] (Mark Lobue) writes: > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > Sent: Saturday, October 11, 2003 10:19 PM > > To: [EMAIL PROTECTED] > > Subject: RE: working on time > > > > > > It's fair enough to use 86,400 sec in a day. But what a

R: malformed header

2003-10-14 Thread Nino V
Hi, Rob! You were right! Thanks to you I've fixed the script. Thanks a lot. Ciao, Nino = http://www.vessella.it (italiano, esperanto, kiswahili, english) http://www.changamano.org (Iniziative di solidarietà per la Tanzania) Corso di lingua swahili: http://corsos

Which action button clicked?

2003-10-14 Thread perl
Can someone show me how to determine which button the user clicked? use CGI; $cgi->param did not contain the action parameter. I want to determine if the user click the LEFT or RIGHT button: ... ... thanks -rkl - eMail solutions by http://www.swanmai

SHOW TABLES and related options for SQL are not working

2003-10-14 Thread ramakrishna
Hi, I have installed Perl from Active State.com in Win2K advanced server and no other Packages are installed. I am able to connect to Sql server and get the data also. But when i use DESCRIBE mytable; SHOW TABLES; error is shown as " Can't locate object method 'DESCRIBE' via package "mytable"

Re: DBI::XBase not finding table files

2003-10-14 Thread Gary Stainburn
On Monday 13 Oct 2003 6:19 pm, Daniel Staal wrote: > --On Monday, October 13, 2003 17:37 +0100 Gary Stainburn > > <[EMAIL PROTECTED]> wrote: > > Hi folks, > > I've got the code below, which is suposed to be showing me the > > contents of a .dbf file. However, whenever I try to run the > > progra

RE: help float to string

2003-10-14 Thread Marcos . Rebelo
try the sprintf print sprint("%.02f", $f); if I'm not rong; -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 14, 2003 10:18 AM To: [EMAIL PROTECTED] Subject: help float to string Can someone help me with retaining the precisions when they ar

help float to string

2003-10-14 Thread perl
Can someone help me with retaining the precisions when they are zero? ie - $f = 9.00 $z = $f; print $z; #result in 9 - bad I want 9.00 $fx = 9.25 $z = $fx; print $z; #result in 9.25 - good I can but don't want to use a sub like itoa. Is there a better way to convert to string? $z=itoa($f); pri

Re: sort w/o using an array

2003-10-14 Thread John W. Krahn
John Fisher wrote: > > I am trying to figure out if there is a way to do a sort that > doesn't involve putting an entire file in memory. This kind of > thing is available in apps like syncsort, where you give it > arguments and it uses disk space/virtual memory to do the work. Do a search for "ta