[7671] in Perl-Users-Digest
Perl-Users Digest, Issue: 1297 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 10 18:14:48 1997
Date: Mon, 10 Nov 97 15:00:32 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 10 Nov 1997 Volume: 8 Number: 1297
Today's topics:
500 Internal Server Error (FRANCO)
Anxiously awaiting my Perl Resource Kit <blakem@seas.upenn.edu>
Re: array to scalar coercion (mysplice) <rootbeer@teleport.com>
beginner <lecorre@magic.fr>
Bizarre glitch in Net::Whois (Stunt Pope)
Block comments in Perl? <luutran@geocities.com>
Re: Block comments in Perl? (Matthew Cravit)
Re: Block comments in Perl? (Tad McClellan)
Re: By value or reference <rootbeer@teleport.com>
Re: Chomp vs Chop <rootbeer@teleport.com>
Re: Chopping up those variables <rootbeer@teleport.com>
Finding "best fit" subset of a set? (Matthew Cravit)
Help with Win32::Registry Module <asupcsi@cyberramp.net>
Re: How do I create a random number with Perl? <rootbeer@teleport.com>
Re: NCSA Httpd Error 500 <susan.cassidy@sandiegoca.ncr.com>
Newbie extraction question <a15d@unb.ca>
Re: Newbie extraction question (Faust Gertz)
Re: Newbie extraction question <markm@nortel.ca>
newbie having trouble with install (David Storrs)
Re: ODBC and Apostrophe (Wesley)
Passing a %hash via Shared mem. ?? (Dharmen Sanghvi)
Re: passing hash references to subs <rootbeer@teleport.com>
Re: PERL Novice Needs a Little Help <rootbeer@teleport.com>
Re: perl script for generating simple web page (Mike Stok)
Re: perl warning annoying me <rootbeer@teleport.com>
Re: perl with procmail <rootbeer@teleport.com>
Re: Please help: make test fails for Perl 5.004_04 <rootbeer@teleport.com>
Re: Question on module "get.pl" <rootbeer@teleport.com>
Question::Socket Handles as Variables. <corcordt@cs.purdue.edu>
Re: reading from end of file <rootbeer@teleport.com>
Re: scalar function weird <rootbeer@teleport.com>
Re: SQL statement in Perl (Toutatis)
Re: SQL statement in Perl (Wesley)
Unix to Windows ODBC database? (Alex Panagides)
Re: Updating current HTML page with Perl CGI... HELP!! <rootbeer@teleport.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 10 Nov 1997 21:36:52 GMT
From: franco@hacker.com (FRANCO)
Subject: 500 Internal Server Error
Message-Id: <647upk$s9p$4@news.mandic.com.br>
HI ,
I have a problem on Apache 1.2.0(Binary Dowload)Runing on LInux 1.2.13,
On execute Scripts (CGI/Perl) , an error ocorred , is : 500 Internal
Server Error, hum... and nao ???
Anyone help me ??
..:mail me to fecap39@hotmail.com
TanKX
FRANCO<> ++
ps: Sorry , but i dont speack eng. verry well..
------------------------------
Date: 10 Nov 1997 21:44:43 GMT
From: "Blake D. Mills IV" <blakem@seas.upenn.edu>
Subject: Anxiously awaiting my Perl Resource Kit
Message-Id: <647v8b$g3h$1@netnews.upenn.edu>
I'm due to receive my PRK in the next day or so, and am rather excited
about it. Has anyone out there already recieved a kit, or possibly
tested the pre-releases? Anyone have any first-impressions?
-Blake
------------------------------
Date: Mon, 10 Nov 1997 14:42:56 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: bnelson@iname.com
Subject: Re: array to scalar coercion (mysplice)
Message-Id: <Pine.GSO.3.96.971110144210.24121V-100000@usertest.teleport.com>
On Sun, 9 Nov 1997, Bob Nelson wrote:
> Here's a less ambitious subroutine yielding the diagnostic: ``Bizarre
> copy of ARRAY in aassign at ...''.
This sounds like a job for... perlbug! :-)
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Mon, 10 Nov 1997 22:30:35 +0100
From: "LE CORRE" <lecorre@magic.fr>
Subject: beginner
Message-Id: <647ubi$9ti$1@paris.magic.fr>
Help ! I don't know how to use perl in spite of faq and readme files. I'm
just a beginner and I don't speak fluently english !! I've downloaded and
uncompressed Perl 5.004_04 in a Perl directory (running under win 95) but I
don't know how to run my " firstscript.pl " written with a simple text
editor. Thanks.
lecorre@hotmail.com
------------------------------
Date: 10 Nov 1997 18:54:59 GMT
From: markjr@mail.PrivateWorld.com (Stunt Pope)
Subject: Bizarre glitch in Net::Whois
Message-Id: <647la3$fmj$1@newsbell.bellglobal.com>
------------------------Begin ROT26 Encoded Text
Sorry if this has been mentioned before, but I didn't turn anything up
in deja news...
I ran into this on a slackware 2.0.27 box where I wrote a script, and also
on a BSDI box where I later installed the script, running 5.003 and
5.003_07 repectively:
Not enough arguments for upper case at /usr/local/lib/site_perl/Net/Whois.pm \
line 254, near "uc}"
The offending line is:
@{$info{CONTACTS}}{map {uc} @ctypes} = (\@c) x @ctypes;
now unless I'm mistaken, if there are no parameters supplied to uc, then
it should operate on $_ (like anything else), so in my mind there *seems*
to be nothing wrong with this line.
changing this line to:
@{$info{CONTACTS}}{map {uc $_} @ctypes} = (\@c) x @ctypes;
fixes the problem and the script operates as expected.
The problem exists in both Net-Whois-0.21 and Net-Whois-0.22.
------------------------End ROT26 Encoded Text
Mark Jeftovic aka: mark jeff or vic, stunt pope.
markjr@shmOOze.net http://www.shmOOze.net/~markjr
PWC's BOFH http://www.PrivateWorld.com
irc: L-bOMb Keep `em Guessing
------------------------------
Date: 10 Nov 1997 18:15:44 GMT
From: "Luu Tran" <luutran@geocities.com>
Subject: Block comments in Perl?
Message-Id: <35744.4279846065luutrangeocitiescom@207.217.245.11>
Hi,
This is dumb but how do I do block comments in Perl (5.003)? perlsyn says C
style /* */ block comment is out, so how?
tia
-- luu
------------------------------
Date: 10 Nov 1997 12:13:13 -0800
From: mcravit@best.com (Matthew Cravit)
Subject: Re: Block comments in Perl?
Message-Id: <647psp$dt6$1@shell3.ba.best.com>
In article <35744.4279846065luutrangeocitiescom@207.217.245.11>,
Luu Tran <luutran@geocities.com> wrote:
>Hi,
>
>This is dumb but how do I do block comments in Perl (5.003)? perlsyn says C
I assume you mean something like the following, which is usually how I do
them (in fact, this is extracted from a random script I have lying around
for work):
#!/usr/bin/perl -w -- -*- Perl -*-
###########################################################################
# MakeHostList : Given a subnet (XXX.YYY.ZZZ), build a list of all hosts
# on that subnet.
#
# Matthew Cravit, mcravit@net.com
###########################################################################
# RCS Source : $Source: /home/mcravit/scripts/Perl/RCS/MakeHostList.pl,v $
# Revision : $Revision: 1.3 $
# Last Update: $Date: 1997/08/01 22:16:46 $ $Author: mcravit $
###########################################################################
Hope this helps.
/MC
--
Matthew Cravit, N9VWG | Experience is what allows you to
E-mail: mcravit@best.com (home) | recognize a mistake the second
mcravit@taos.com (work) | time you make it.
------------------------------
Date: Mon, 10 Nov 1997 16:00:03 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Block comments in Perl?
Message-Id: <350846.kg2.ln@localhost>
Luu Tran (luutran@geocities.com) wrote:
: This is dumb
Yep, you are right.
Posting without checking the FAQ is indeed dumb.
Find it in the FAQ and you've gotten the answer in one or two minutes.
Post to Usenet and wait hours, days, or forever...
: but how do I do block comments in Perl (5.003)? perlsyn says C
: style /* */ block comment is out, so how?
Perl FAQ, part 7:
"How can I comment out a large block of perl code?"
Don't you feel kinda silly?
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 10 Nov 1997 14:18:52 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Francois <leurmy@akula.com>
Subject: Re: By value or reference
Message-Id: <Pine.GSO.3.96.971110140937.24121R-100000@usertest.teleport.com>
On Sun, 9 Nov 1997, Francois wrote:
> Is it possible to assign the value of a variable to another variable and
> that this new variable keeps that same value even if the first variable
> changes its value?
Yes. In fact, it's the normal state of affairs! If something else is
happening, the's something funny going on.
> I have a While loop that reads the <STDIN>...and a @data_stream that
> gets the value from the form for each field.
>
> if ($field_name == "your_name") {
Not using -w, are you? :-) Perl will tell you what's wrong, if you ask it
to. Check perlrun(1). Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Mon, 10 Nov 1997 12:56:08 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Mark Mielke <markm@nortel.ca>
Subject: Re: Chomp vs Chop
Message-Id: <Pine.GSO.3.96.971110125019.24121K-100000@usertest.teleport.com>
On 7 Nov 1997, Mark Mielke wrote:
> while (<STDIN>) {
> }
>
> Hmmm... interesting... what if one of the lines is a sole "0"...
No problem - that code is equivalent to this.
while (defined($_ = <STDIN>)) { ... }
> i've seen this many times as well:
>
> while ($_ = shift) {
> }
That's bad.
> while (defined($_ = shift)) {
> }
That doesn't help much, since an element of a list may be undef. (Of
course, @ARGV shouldn't have undef, but @_ may.) The real way is like
this.
while (@list) { $_ = shift @list; ... }
...or maybe this.
for (@list) { ... } # non-destructive
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Mon, 10 Nov 1997 13:39:06 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Tom Riley <TJRiley@btinternetNOSPAM.com>
Subject: Re: Chopping up those variables
Message-Id: <Pine.GSO.3.96.971110133647.24121M-100000@usertest.teleport.com>
On Sat, 8 Nov 1997, Tom Riley wrote:
> I need to take a string variable and be able to put the first 40 words of it
> into another variable. I have tried to do this is various ways with little
> success. Is there a simple way to do this?
Yes. You could use split or a regular expression. If you define words as
being anything separated by spaces, you could even use substr and index.
Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 10 Nov 1997 14:40:39 -0800
From: mcravit@best.com (Matthew Cravit)
Subject: Finding "best fit" subset of a set?
Message-Id: <6482h7$1mg$1@shell3.ba.best.com>
I'm in the process of writing a perl script to "stage" files for writing
to a CD-ROM, and I'd like to find a function/module which will, given an
array of integers, return the subset of them whose sum is closest to a
specified "target" value. In other words, given an array which contains
the sizes of a series of directories, I want it to return the subset of
those directories which most closely approximates 625 megs.
Does anyone know if a module exists that could do this? I didn't find anything
obvious on CPAN. Alternatively, could someone suggest an algorithm that I
could use to write my own?
Any suggestions, tips, pointers, or whatever, are greatly appreciated.
Thanks.
/MC
--
Matthew Cravit, N9VWG | Experience is what allows you to
E-mail: mcravit@best.com (home) | recognize a mistake the second
mcravit@taos.com (work) | time you make it.
------------------------------
Date: 10 Nov 1997 20:21:03 GMT
From: "scis" <asupcsi@cyberramp.net>
Subject: Help with Win32::Registry Module
Message-Id: <01bcee16$935ba800$c21415ac@fusat36_281>
I have the 5.004 binary dist of perl running under NT. I cannot locate any
good doc's on the Win32:Registry module that is included. Activeware's
doc's don't seem to coincide with what is in this distribution. If someone
could point me to where I can find documentation specific to this module I
would greatly appreciate it. Or, second best, post some sample source so
that I may learn how the various calls are used with real world examples.
Thanks,
Clay
------------------------------
Date: Mon, 10 Nov 1997 14:28:37 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Eric Phillips <e.phillips@mindspring.com>
Subject: Re: How do I create a random number with Perl?
Message-Id: <Pine.GSO.3.96.971110142618.24121S-100000@usertest.teleport.com>
On Sat, 8 Nov 1997, Eric Phillips wrote:
> I am no expert, just an amateur, so please explain in detail.
>
> How do I create a random number with Perl, so it can be use later in the
> script?
Here's a random number: one. If that's not random enough, use two. :-)
Or you could read the perlfunc(1) man page, looking for the word "random".
If you still have questions not answered there, ask again. Hope this
helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Mon, 10 Nov 1997 13:56:28 -0800
From: Susan Cassidy <susan.cassidy@sandiegoca.ncr.com>
Subject: Re: NCSA Httpd Error 500
Message-Id: <3467830C.6E64@sandiegoca.ncr.com>
devesh wrote:
>
> Hi,
> I Have written a software using Apache Web server. The software when ported to
> another m/c running NCSA Web server gives the following error for some cgi scrip
> ts when called from Web browser
>
> HTTPd: malformed header from script /u/d/devesh/tmp/cgi-bin/hello1.pl
>
> The scripts run fine on command prompt. I have no clue, is it a server configrat
> ion problem or what. I am using cgi-lib.pl library.
> Even the simple code like this gives the same error
> -----
> #!/usr/bin/perl
> require ("cgi-lib.pl");
> &ReadParse (*input);
> print &PrintHeader;
> print <<"end";
> <HTML><BODY>blah blah blah</BODY></HTML>
> end
> -----
> I am using NCSA httpd version 1.5.1
>
> Any suggestions????
>
> Thanxs,
> devesh
>
> --
>
> **********************************************
> devesh Jain
> 13/150 alma rd.
Could very well be a permissions problem. Check the NCSA server error
log (just do a tail on it right after you get the error). Make sure
that whatever user id the script is run as (by the server) has execute
permission.
------------------------------
Date: Mon, 10 Nov 1997 16:20:56 -0400
From: ASHFIELD M <a15d@unb.ca>
Subject: Newbie extraction question
Message-Id: <Pine.SOL.3.96.971110161400.3239A-100000@sol.sun.csd.unb.ca>
Hi,
Sorry if this is super newbie, I've been trying to go through the
documentation, and I have just located a copy of the Camel book, but
haven't gotten a chance to pick it up yet. Anyway, I haven't quite been
able to figure out how I'd go about doing the following. I am trying to
write a script that will extract text from between HTML tags. I don't
want to strip the tags as many examples have shown on the net. Basically,
an example is the following....:
<title>Title name here</title>
<author> author name here</author>
What I want to be able to do is to extract the data between these tags to
say variables $title and $author. The problem is, my title may be very
long, ie. over multiple lines, so I guess I'm wondering as to how to do
this.
I realize this is probably one of those posts which produces instant
frowns, and I apologize for that, just hoping someone might be able to
help me out.
Thanks for your time,
Matt
a15d@unb.ca
------------------------------
Date: Mon, 10 Nov 1997 23:00:56 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: Newbie extraction question
Message-Id: <34678e0c.8129284@news.wwa.com>
On Mon, 10 Nov 1997 16:20:56 -0400, ASHFIELD M <a15d@unb.ca> wrote:
>Sorry if this is super newbie,
[Yadda, Yadda, Yadda, . . .]
><title>Title name here</title>
><author> author name here</author>
>
>What I want to be able to do is to extract the data between these tags to
>say variables $title and $author. The problem is, my title may be very
>long, ie. over multiple lines, so I guess I'm wondering as to how to do
>this.
Please enjoy the following _untested_ code, which is not at all
guaranteed to work.
:my ($title, $author);
:$/ = undef;
:open (HTML, $a_file) || die "$0 couldn't open $a_file: $!";
:while <HTML> {
: if (/^<TITLE>(.*)<\/TITLE>$/) { $title = $1 }
: if (/^<AUTHOR>(.*)<\/AUTHOR>$/) { $author = $1 }
:}
:print "Title = $title\nAuthor = $author\n\n";
:exit
HTH
Faust Gertz
Philosopher at Large
------------------------------
Date: 10 Nov 1997 17:32:07 -0500
From: Mark Mielke <markm@nortel.ca>
Subject: Re: Newbie extraction question
Message-Id: <lq167q08jo8.fsf@bmerhe83.nortel.ca>
ASHFIELD M <a15d@unb.ca> writes:
> ... I am trying to
> write a script that will extract text from between HTML tags. I don't
> want to strip the tags as many examples have shown on the net. Basically,
> an example is the following....:
> <title>Title name here</title>
> <author> author name here</author>
> What I want to be able to do is to extract the data between these tags to
> say variables $title and $author. The problem is, my title may be very
> long, ie. over multiple lines, so I guess I'm wondering as to how to do
> this.
About the proper way to do it? I dunno :-) I'm only human :-)
But this is one way you could try (assuming you call this html_section_extract)
$ echo "<title>This is my title\nSecond Line\nThird Line</title>" |
> html_section_extract title
This is my title
Second Line
Third Line
--- CUT HERE ---
#!/usr/bin/perl
# -*- perl -*-
# NOTE: Currently, this script will NOT work on tags with arguments,
# and it will NOT work well with comments. (although it may seem to)
use FileHandle;
sub html_section_extract
{
my($html_code, $section_name) = @_;
my @section_bodies;
$section_name = quotemeta $section_name;
while ($html_code =~ /<$section_name>(.*)<\/$section_name>/gis) {
push(@section_bodies, $1);
}
wantarray ? @section_bodies : $section_bodies[0];
}
if (@ARGV == 0) {
die "Usage: $0 {section_to_extract} [ file ... ]\n";
}
my $section_to_extract = shift(@ARGV);
unshift(@ARGV, '-') unless @ARGV;
my $warnings = 0;
local $SIG{__WARN__} = sub { print STDERR @_; $warnings++ };
my($html_path, $html_f);
foreach $html_path (@ARGV) {
if ($html_path ne '-') {
$html_f = new FileHandle($html_path, "r") || do {
warn "$0: open of $html_path failed: $!\n";
next;
};
} else {
$html_f = *STDIN;
}
$html_f->input_record_separator(undef);
my $html = <$html_f>;
my $section_body;
foreach $section_body (html_section_extract($html, $section_to_extract)) {
if (@ARGV >= 2) {
print "$html_path: $section_body\n";
} else {
print "$section_body\n";
}
}
}
exit $warnings;
--- CUT HERE ---
hope this is what you want :-)
mark
-- _________________________
. . _ ._ . . .__ . . ._. .__ . . . .__ | Northern Telecom Ltd. |
|\/| |_| |_| |/ |_ |\/| | |_ | |/ |_ | Box 3511, Station 'C' |
| | | | | \ | \ |__ . | | .|. |__ |__ | \ |__ | Ottawa, ON K1Y 4H7 |
markm@nortel.ca / al278@freenet.carleton.ca |_______________________|
------------------------------
Date: Mon, 10 Nov 1997 17:20:20 -0500
From: dstorrs@crossover.com (David Storrs)
Subject: newbie having trouble with install
Message-Id: <346788c4.95370289@news.crossover.com>
I've just started learning Perl, so I downloaded the Win32
version for W95 (the 312 build from CPAN). It self-extracted very
nicely, it ran its own installer very nicely, everything was great.
The problem lies in running it. DblClicking the "Perl.exe"
file brings up a DOS-style window which seems to happily ignore all
input, or else give a warning message. I can run it from a DOS shell,
but then any error messages get spewed out and scroll off screen. I
tried redirecting them to a file with:
perl -w somescript.pl > results.txt
but that didn't accomplish anything. I was sort of hoping that there
was a nice, friendly, "type-a-line-watch-it-be-interpreted" sort of
interactive thing here somewhere, but I am obviously missing
something. Could anyone tell me what blazingly obvious fact I have
overlooked so that I can use Perl on my Windoze platform?
Thanks in advance for any help.
Dave Storrs
dstorrs@crossover.com
------------------------------
Date: 10 Nov 1997 20:04:55 GMT
From: wkc@dorsai.org (Wesley)
Subject: Re: ODBC and Apostrophe
Message-Id: <slrn66eq7k.sq1.wkc@amanda.dorsai.org>
Replace all of the ' with '' works. It's a SQL thing. s/'/''/g becomes a
standard line in all my sql lines.
In article <3460797B.D7A84793@diemme.it>, Domenico Viggiani wrote:
>> I'm trying to update a database using perl and have got most of it
>> working successfully except for this one annoying bug. When I try and
>> send a insert a field value that contains an apostrophe... The sql call
>> breaks.
>>
>>
>
>I'm not sure but try to escape the apostrophe with \ or doubling it with
>''.
>
>Sorry if it doesn't help.
>
>Mimmo
>
------------------------------
Date: Mon, 10 Nov 1997 20:30:35 GMT
From: dharmen@netcom.com (Dharmen Sanghvi)
Subject: Passing a %hash via Shared mem. ??
Message-Id: <dharmenEJG6Az.98x@netcom.com>
Hi,
Any Ideas as to how to pass a %hash via shared mem
from a child to a parent ??
Thanks in Advance
--Dharmen
--
#############################################################################
# Excellence can be achieved if you ....... #
# #
# a. Care MORE THAN OTHERS think is Wise, #
# b. Risk MORE THAN OTHERS think is safe, #
# c. Dream MORE THAN OTHERS think is practical, #
# d. Expect MORE THAN OTHERS think is possible. #
# #
# Dharmen Sanghvi - dharmen@netcom.com #
# #
#############################################################################
------------------------------
Date: Mon, 10 Nov 1997 13:35:27 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: "Darwin O.V. Alonso" <dalonso@u.washington.edu>
Subject: Re: passing hash references to subs
Message-Id: <Pine.GSO.3.96.971110132446.24121L-100000@usertest.teleport.com>
On 7 Nov 1997, Darwin O.V. Alonso wrote:
> &dih( \%xyz1, \%xyz2);
> sub dih{
> my ( %xyz1, %xyz2);
> Is that the best way to pass a hash to a subroutine?
Usually yes. But making copies of the entire hash is not the best way for
the sub to use the passed references. Instead, use the refs as refs:
sub dih {
my($h1, $h2) = @_;
for (keys %$h1) { ... }
> What would "use strict" do?
What it's documented to do. :-) (It wouldn't have a problem that I see
with your code. But maybe I need to look more closely. :-)
> How dangerous is it to use %foo{x} vs %foo{"x"}?
Not dangerous at all. $foo{bareword} is defined to be the same as
$foo{'bareword'}. If you want it to be otherwise, you may write
$foo{+bareword} (possible error from 'use strict' if it's not a builtin or
known sub) or $foo{&bareword}, or whatever you mean. (If the bareword is
meaningful, you may get a warning under 'use strict', alas.)
> Should I be locked up for trying to write numerical analysis scripts
> in perl? ;-)
Perhaps. But you may be able to get out if you learn to use modules,
objects, or tie'd variables to make your life easier.
Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Mon, 10 Nov 1997 14:31:19 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Peter Wellens <peterl@cet.com>
Subject: Re: PERL Novice Needs a Little Help
Message-Id: <Pine.GSO.3.96.971110142948.24121T-100000@usertest.teleport.com>
On Sat, 8 Nov 1997, Peter Wellens wrote:
> Subject: PERL Novice Needs a Little Help
Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
> I'd like to write a formatted string to a disk file using the <printf>
> function. However, printf apparently doesn't take a filehandle as an
> argument like <print> does, but instead wants to sent output to STDOUT.
Try again; it should work. Are you properly omitting the comma after the
filehandle's name? Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 10 Nov 1997 18:59:01 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: perl script for generating simple web page
Message-Id: <647lhl$7ud@news-central.tiac.net>
In article <3467489B.8CACEE46@utb1.utb.edu>,
Saul Lopez <saul@utb1.utb.edu> wrote:
>Does anyone know of a simple perl script that takes the input of a form
>and simply appends it to an HTML file?
>I'd appreciate any help.
You might want to look at the CGI module which is a standard part of
recent perl releases. You can find the module's documentation and some
examples at
http://www.genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.html
If you have problems makingCGI scripts written in perl work OK then you
might want to look at http://language.perl.com/faq/index.html and follow
the "Idiot's Guide to Solving Perl/CGI Problems" and "Perl CGI Programming
FAQ" links.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: Mon, 10 Nov 1997 14:46:43 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: doj <doj@cubic.org>
Subject: Re: perl warning annoying me
Message-Id: <Pine.GSO.3.96.971110144329.24121W-100000@usertest.teleport.com>
On Sun, 9 Nov 1997, doj wrote:
> warning: setlocale(LC_CTYPE, "") failed.
> warning: LC_ALL = "(null)", LC_CTYPE = "(null)", LANG = "ko",
> warning: falling back to the "C" locale.
>
> now these annoy me to hell.
> Question: how can I get rid of these warnings ???
There's supposed to be something about this in perldiag(1). (If there's
not, run perlbug to report the omission.) But ther should also be
something in the installation instructions, or another obvious place. Good
luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Mon, 10 Nov 1997 13:57:59 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Tom Halligan <tomh@u1.abs.net>
Subject: Re: perl with procmail
Message-Id: <Pine.GSO.3.96.971110135710.24121P-100000@usertest.teleport.com>
On Sat, 8 Nov 1997, Tom Halligan wrote:
> Insecure $ENV{PATH} while running setgid at /var/www/me/cgi-bin/minordomo
> lin
> e 226.
> I figure of couse that it is a permisions prob, any suggestions?
Check what perldiag(1) has to say about that message. Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Mon, 10 Nov 1997 13:54:38 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: schwager@nobasura_wwa.com
Subject: Re: Please help: make test fails for Perl 5.004_04
Message-Id: <Pine.GSO.3.96.971110134819.24121O-100000@usertest.teleport.com>
On 9 Nov 1997, Michael A. Schwager wrote:
> I'm trying to install Perl 5.004_4 on a Solaris 2.5 Sparc20. make test
> fails on op/pack.t, tests 10 and 22.
> Did I do something wrong when running Configure...
Probably. :-) But that code is relatively new to Perl, and you may have
uncovered a bug in it.
> Everything else tested great... any help?
Have you tried running just that test, to see what diagnostics it prints?
If it doesn't, try fixing the test to print some. :-)
If you find what's wrong, consider fixing the test to make a helpful
suggestion upon failure. ("The value of D_FOOBAR is probably too low") If
you can't fix it, contact the Perl development team. Either way, the
perlbug script should work for you. Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Mon, 10 Nov 1997 13:45:56 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Claudia Ma <maclaudi@cps.msu.edu>
Subject: Re: Question on module "get.pl"
Message-Id: <Pine.GSO.3.96.971110134321.24121N-100000@usertest.teleport.com>
On 9 Nov 1997, Claudia Ma wrote:
> I'm using a module "get.pl"
Modules' names should end in '.pm'. Are you sure that's not a library?
> and got the following error msg:
>
> <89 amlia:/user/web/cgi-user/maclaudi/Hiclas >test.pl
> "use" not allowed in expression at subs.pl line 7, at end of line
> syntax error at subs.pl line 7, near "(use strict"
What version of Perl are you using? The latest is 5.004. The command 'perl
-v' will tell you what yours is.
Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Mon, 10 Nov 1997 17:32:11 -0500
From: David Corcoran <corcordt@cs.purdue.edu>
Subject: Question::Socket Handles as Variables.
Message-Id: <34678B6B.336@cs.purdue.edu>
I'm using the following code
use IO::Handle
.
. Here i just initialized My_socket.
.
$users = new IO::Handle;
$remote = accept ($users,MY_SOCKET);
print $users "Hello\n";
This doesn't work and I would like to write a server which I can
select the handle to print to. Of course i would change $users
to an array but I can't seem to print to the varible filehandle
Any Suggestions ????
Thanks
Dave
------------------------------
Date: Mon, 10 Nov 1997 12:47:16 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: dan weaver <d-weaver@nwu.edu>
Subject: Re: reading from end of file
Message-Id: <Pine.GSO.3.96.971110123220.24121J-100000@usertest.teleport.com>
On Fri, 7 Nov 1997, dan weaver wrote:
> I would like to read a file from the end since it is a very large text
> file. Is there any way to open a file for reading lines of text
> backwards, starting fromthe last line? I checked the FAQ.
In what way was the FAQ's answer insufficient for your needs? :-) (The
info about line-oriented file access is near the start of perlfaq5.)
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Mon, 10 Nov 1997 14:06:50 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: mehta@mama.indstate.edu
Subject: Re: scalar function weird
Message-Id: <Pine.GSO.3.96.971110140447.24121Q-100000@usertest.teleport.com>
On Fri, 7 Nov 1997 mehta@mama.indstate.edu wrote:
> Subject: scalar function weird
No, it's not weird. It's not even a function. :-)
'scalar' is merely a clue to the compiler that what follows is to be
evaluated in a scalar context. That's all. It merely _looks_ like a
function. :-)
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 10 Nov 1997 20:34:09 GMT
From: toutatis@_SPAMTRAP_toutatis.net (Toutatis)
Subject: Re: SQL statement in Perl
Message-Id: <toutatis-ya023180001011972134120001@news.euro.net>
Henry Hartley <henry@DotRose.com> wrote:
> I'm working on an Intranet '411' application for my company. I have a
> Perl script that looks up data in a MS Access database depending upon
> what the user enters into the five fields. It MOSTLY works. What I
> can't get to work is the sorting of the data. I have the following SQL
> statment (the first line part is all one line):
>
> $sql = sprintf("select * from phonebook where LastName like '%s'
> and FirstName like '%s' and Extension like '%s' and Building like '%s'
> and Room like '%s' order by '%s'", $lastname . "\%", $firstname . "\%",
> $exten . "\%", $bldg . "\%", $roomnum . "\%", $sortby);
> $query->Sql($sql);
>
> This returns the correct data but the "order by $sortby" portion seems
> to do nothing. $sortby contains one of the field names from the Access
> table. Any suggestions?
This has nothing to do with perl, but I'll give you some hints anyway:
1. Remove the quotes around the order. Fieldnames don't need to be quoted.
2. Check $sql by logging it to STDERR when debugging your program.
3. sprintf is unnessecary complicated. $sql = qq(name like '\%$value')
would save you a headache.
--
Toutatis
------------------------------
Date: 10 Nov 1997 20:35:42 GMT
From: wkc@dorsai.org (Wesley)
Subject: Re: SQL statement in Perl
Message-Id: <slrn66es1b.sq1.wkc@amanda.dorsai.org>
I don't know Access but in standard SQL, you can only specify the column
name of the table or column position of the table such as 'order by 3,1'.
Wildcard character % cannot be in there. May be Access works differently.
What do you want it sorted by?
mailto:wkc@cetus.net
In article <346743CB.8461D604@DotRose.com>, Henry Hartley wrote:
>I'm working on an Intranet '411' application for my company. I have a
>Perl script that looks up data in a MS Access database depending upon
>what the user enters into the five fields. It MOSTLY works. What I
>can't get to work is the sorting of the data. I have the following SQL
>statment (the first line part is all one line):
>
> $sql = sprintf("select * from phonebook where LastName like '%s'
>and FirstName like '%s' and Extension like '%s' and Building like '%s'
>and Room like '%s' order by '%s'", $lastname . "\%", $firstname . "\%",
>$exten . "\%", $bldg . "\%", $roomnum . "\%", $sortby);
> $query->Sql($sql);
>
>This returns the correct data but the "order by $sortby" portion seems
>to do nothing. $sortby contains one of the field names from the Access
>table. Any suggestions?
>
>Henry
>
>
------------------------------
Date: 10 Nov 1997 11:12:41 -0800
From: alex@inova.net (Alex Panagides)
Subject: Unix to Windows ODBC database?
Message-Id: <34674F81.3247@inova.net>
What is required (Perl speaking) to access a MS Access database from a
Unix box? I have the DBI-0.90 module installed. Anything else?
Any help would be greatly appreciated,
Alex Panagides
Ceara, Brazil
PS. Bonus question :) What would the connect statement look like?
------------------------------
Date: Mon, 10 Nov 1997 14:38:09 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Guy Doucet <gdoucet@ait.acl.ca>
Subject: Re: Updating current HTML page with Perl CGI... HELP!!
Message-Id: <Pine.GSO.3.96.971110143613.24121U-100000@usertest.teleport.com>
On Sun, 9 Nov 1997, Guy Doucet wrote:
> But I get an error when trying to open the file with the > write symbol.
> Probably because the file is currently open.
That shouldn't be the cause of an error (on most systems). It should
simply delete the file, and prepare to rewrite it. :-D But maybe it's a
permission problem. What's the message?
When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
such problems. It's available on CPAN. Hope this helps!
http://www.perl.com/CPAN/
http://www.perl.org/CPAN/
http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html
http://www.perl.org/CPAN/doc/manual/html/pod/
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 1297
**************************************