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..
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
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
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
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
[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 $
> [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
>
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
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
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
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
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
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
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,
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
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
>
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
--
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
--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
--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
[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
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 }
[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
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
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
[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.
>
> $
--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
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"
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
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:
>
>
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
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
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
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
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
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
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
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
[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
> "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
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
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
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
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
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?
> > >
> > >
> >
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
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
> 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
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
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
(
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
[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
[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
[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
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
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
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"
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
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
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
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
61 matches
Mail list logo