[13026] in Perl-Users-Digest
Perl-Users Digest, Issue: 436 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 9 20:17:19 1999
Date: Mon, 9 Aug 1999 17:10:14 -0700 (PDT)
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, 9 Aug 1999 Volume: 9 Number: 436
Today's topics:
Reading the Online Documentation? (Mesarchm)
Re: Reading the Online Documentation? (I R A Darth Aggie)
Re: Reading the Online Documentation? <flavell@mail.cern.ch>
Re: Reading the Online Documentation? (Mesarchm)
Re: Reading the Online Documentation? (Malcolm Ray)
Re: Reading the Online Documentation? (Mesarchm)
Re: Reading the Online Documentation? (Malcolm Ray)
Re: Reading the Online Documentation? (Graham Ashton)
Replace section in file with another file <fncll@uaf.edu>
Sorting Backwards (Mesarchm)
Re: Sorting Backwards (Larry Rosler)
Re: Sorting Backwards (Bill Moseley)
Re: Sorting Backwards (Bill Moseley)
Re: Sorting Backwards (Mesarchm)
Re: Sorting Backwards (Malcolm Ray)
Re: Sorting Backwards (Graham Ashton)
Speed Up - Unexperienced <ionsearch@ionsearch.com>
Re: Stopping someone from getting my cgi-scripts (Michel Dalle)
Re: Stopping someone from getting my cgi-scripts <kperrier@blkbox.com>
Re: Stopping someone from getting my cgi-scripts (Marcel Grunauer)
Re: String compare (Martien Verbruggen)
Re: Web Calendar Help.... !!! <rootbeer@redcat.com>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 09 Aug 1999 22:11:13 GMT
From: mesarchm@aol.com (Mesarchm)
Subject: Reading the Online Documentation?
Message-Id: <19990809181113.04942.00000450@ng-ch1.aol.com>
Why is it that everytime someone asks a question instead of being helpful
people reply with a "read the online documentation". If you don't want to help
someone out, don't. It is obvious that they are new to perl and need some
help. Sure you can mention that the docs are a good place to look, but if you
know the answer give it to them, don't be a ass.
Mike
------------------------------
Date: 9 Aug 1999 22:30:29 GMT
From: fl_aggie@thepentagon.com (I R A Darth Aggie)
Subject: Re: Reading the Online Documentation?
Message-Id: <slrn7quloa.1p0.fl_aggie@thepentagon.com>
On 09 Aug 1999 22:11:13 GMT, Mesarchm <mesarchm@aol.com>, in
<19990809181113.04942.00000450@ng-ch1.aol.com> wrote:
+ It is obvious that they are new to perl and need some help.
Fine. Let them specify what it is that they've done already. It saves
anyone who chooses to answer the trouble of starting at the beginning.
+ Sure you can mention that the docs are a good place to look,
Well, that *is* the beginning. If you can't read the documents, then
trying to learn perl will be an exercise in futility and frustration.
Usenet should be the place of last resort for answers to questions.
+ but if you know the answer give it to them, don't be a ass.
So I can insure that they'll be back tomorrow, trolling for another
answer?
James
--
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN/doc/FAQs/cgi/idiots-guide.html>
------------------------------
Date: Tue, 10 Aug 1999 00:26:40 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Reading the Online Documentation?
Message-Id: <Pine.HPP.3.95a.990810002434.12531E-100000@hpplus03.cern.ch>
On 9 Aug 1999, Mesarchm wrote:
> Why is it that everytime someone asks a question instead of being helpful
> people reply with a "read the online documentation".
The answer to that frequently asked question is almost certainly to be
found in the online documentation.
> If you don't want to help
> someone out, don't.
Au contraire, the online documentation is of far more use to them than a
one-off here. It's the difference between giving them one fish, and
setting them up for a lifetime's fishing.
------------------------------
Date: 09 Aug 1999 23:25:26 GMT
From: mesarchm@aol.com (Mesarchm)
Subject: Re: Reading the Online Documentation?
Message-Id: <19990809192526.13206.00002830@ng-bj1.aol.com>
My point is that they obviosly tried the docs and it didn't make sense. So
people turn here for help. Then a few people who THINK they know everything
reply to half the messages posted w/ "Read the Docs"
------------------------------
Date: 9 Aug 1999 23:28:48 GMT
From: M.Ray@ulcc.ac.uk (Malcolm Ray)
Subject: Re: Reading the Online Documentation?
Message-Id: <slrn7qup1g.qkv.M.Ray@carlova.ulcc.ac.uk>
On 09 Aug 1999 22:11:13 GMT, Mesarchm <mesarchm@aol.com> wrote:
>Why is it that everytime someone asks a question instead of being helpful
>people reply with a "read the online documentation". If you don't want to help
>someone out, don't. It is obvious that they are new to perl and need some
>help. Sure you can mention that the docs are a good place to look, but if you
>know the answer give it to them, don't be a ass.
>Mike
Stick around here and you'll see some *wrong* answers to questions.
If I were a beginner with a problem, I'd be pretty annoyed to have
my time wasted in that way. It's far better to be pointed to the
*accurate* documentation - which, incidentally, will answer questions
you didn't even know you had!
--
Malcolm Ray University of London Computer Centre
------------------------------
Date: 09 Aug 1999 23:36:30 GMT
From: mesarchm@aol.com (Mesarchm)
Subject: Re: Reading the Online Documentation?
Message-Id: <19990809193630.09549.00004471@ng-bj1.aol.com>
I am not argueing that the docs aren't the best place to look 1st. But what I
am saying is that if people turn to you for help, being willing to help. The
perfect example is Mr. Know it all (Just Another Larry) Rosler Hewlett-Packard
Laboratories. He answers 90% of the posts on this newsgroup w/ "Read the Docs"
Get a life. If you have nothing better to do then sit around all day and not
help people then you really need to get out and get a life.
Mike
------------------------------
Date: 9 Aug 1999 23:39:34 GMT
From: M.Ray@ulcc.ac.uk (Malcolm Ray)
Subject: Re: Reading the Online Documentation?
Message-Id: <slrn7quplm.qkv.M.Ray@carlova.ulcc.ac.uk>
On 09 Aug 1999 23:25:26 GMT, Mesarchm <mesarchm@aol.com> wrote:
>My point is that they obviosly tried the docs and it didn't make sense. So
>people turn here for help. Then a few people who THINK they know everything
>reply to half the messages posted w/ "Read the Docs"
Those answers are usually given to questions where it's *not* apparent
that the questioner has read the docs. And, by the way, that's not the
action of someone who thinks they know everything: such a person would
surely want to craft responses using their *own* words and code, rather
than draw attention to someone else's ready made answers.
--
Malcolm Ray University of London Computer Centre
------------------------------
Date: 9 Aug 1999 23:45:37 GMT
From: billynospam@mirror.bt.co.uk (Graham Ashton)
Subject: Re: Reading the Online Documentation?
Message-Id: <slrn7quq12.2a9.billynospam@wing.mirror.bt.co.uk>
In article <19990809193630.09549.00004471@ng-bj1.aol.com>, Mesarchm wrote:
>I am not argueing that the docs aren't the best place to look 1st. But
>what I am saying is that if people turn to you for help, being willing
>to help.
sure, but quite often I find that I know where to look to solve the
problem, but am not the best authority on the matter so decide not to
start spreading (what could be) misinformation. so I might put out a
pointer to the right part of the docs instead. it's better than nothing,
right?
>The perfect example is Mr. Know it all (Just Another Larry) Rosler
>Hewlett-Packard Laboratories.
well he's obviously not in the same boat as me (I don't know what I'm
talking about) but I don't think it's fair to infer what people are
thinking when they post "RTFM" responses. people often don't say just
what it is that they don't understand in the docs, which makes it much
more difficult to post a concise (lets face it, most of us are busy
people) and useful answer.
unless you say why you don't get it, you're likely to get pointed back
to the ever so wonderful pods, IMO.
--
Graham
P.S. <billynospam@mirror.bt.co.uk> is a fully working address...
------------------------------
Date: Mon, 09 Aug 1999 22:49:20 GMT
From: Chris L <fncll@uaf.edu>
Subject: Replace section in file with another file
Message-Id: <7onlte$6q2$1@nnrp1.deja.com>
I've searched the archives and read the fAQ (5)... and while I
understand how to replace a string in a file with another string, I'm
unclear how to replace a section in a file with the whole of another
file.
My website has menus surrounded by comment tags:
<!--startmenu-->
foostuff
<!--endmenu-->
I would like to replace that section with another section that resides
in a file...
c
--
Chris Lott <fncll@uaf.edu>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 09 Aug 1999 22:15:34 GMT
From: mesarchm@aol.com (Mesarchm)
Subject: Sorting Backwards
Message-Id: <19990809181534.04942.00000452@ng-ch1.aol.com>
I know how to sort a hash, but how do I sort it backwards. I am trying to sort
by time. Currently 0128 will come up first and the last one will be 2345. I
want it to be the opposite. The current code I am using is:
foreach $alert (sort keys %notification)
{
compare($alert);
}
------------------------------
Date: Mon, 9 Aug 1999 15:46:51 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Sorting Backwards
Message-Id: <MPG.1218fa367953999e989e13@nntp.hpl.hp.com>
In article <19990809181534.04942.00000452@ng-ch1.aol.com> on 09 Aug 1999
22:15:34 GMT, Mesarchm <mesarchm@aol.com> says...
> I know how to sort a hash, but how do I sort it backwards. I am trying to sort
> by time. Currently 0128 will come up first and the last one will be 2345. I
> want it to be the opposite. The current code I am using is:
>
> foreach $alert (sort keys %notification)
> {
> compare($alert);
> }
From your previous post: "read the online documentation" :-)
Specifically, perldoc -f reverse.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 9 Aug 1999 16:03:01 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: Sorting Backwards
Message-Id: <MPG.1218fe00d579e4cd98969a@nntp1.ba.best.com>
Mesarchm (mesarchm@aol.com) seems to say...
> I know how to sort a hash, but how do I sort it backwards.
perldoc -f sort
and look at $a and $b
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
------------------------------
Date: Mon, 9 Aug 1999 16:07:32 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: Sorting Backwards
Message-Id: <MPG.1218ff1029354b8d98969b@nntp1.ba.best.com>
Mesarchm (mesarchm@aol.com) seems to say...
> I know how to sort a hash, but how do I sort it backwards
and
perldoc -f reverse
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
------------------------------
Date: 09 Aug 1999 23:23:02 GMT
From: mesarchm@aol.com (Mesarchm)
Subject: Re: Sorting Backwards
Message-Id: <19990809192302.13206.00002829@ng-bj1.aol.com>
I obviously read those and it didn't make sense. I also read the perl cookbook
p.144 and several other references. If it had made sense I wouldn't be asking
for help. If you don't know the answer don't reply. If you do, I appreciate
it.
------------------------------
Date: 9 Aug 1999 23:34:35 GMT
From: M.Ray@ulcc.ac.uk (Malcolm Ray)
Subject: Re: Sorting Backwards
Message-Id: <slrn7qupcb.qkv.M.Ray@carlova.ulcc.ac.uk>
On 09 Aug 1999 22:15:34 GMT, Mesarchm <mesarchm@aol.com> wrote:
>I know how to sort a hash, but how do I sort it backwards. I am trying to sort
>by time. Currently 0128 will come up first and the last one will be 2345. I
>want it to be the opposite. The current code I am using is:
>
>foreach $alert (sort keys %notification)
^^^^^^^^^^^^^^^^^^^^^^^
This returns a list. 'perldoc -f reverse' will tell you about a function
which will return the elements of a list in reverse order.
--
Malcolm Ray University of London Computer Centre
------------------------------
Date: 9 Aug 1999 23:39:00 GMT
From: billynospam@mirror.bt.co.uk (Graham Ashton)
Subject: Re: Sorting Backwards
Message-Id: <slrn7qupkl.2a9.billynospam@wing.mirror.bt.co.uk>
In article <19990809192302.13206.00002829@ng-bj1.aol.com>, Mesarchm wrote:
>I obviously read those and it didn't make sense. I also read the perl
>cookbook p.144 and several other references. If it had made sense I
>wouldn't be asking for help. If you don't know the answer don't reply.
>If you do, I appreciate it.
okay. well it goes like this.
I seem to recall (haven't got your original post handy) that you had
something like;
foreach $key (sort keys %hash) {
# blah blah blah
}
the keys() function returns a list of keys from the %hash. this list
gets passed into sort(), which returns the sorted list for foreach to
iterate over.
you're probably aware that the bit in the brackets after foreach is in
list context. apply that bit of knowledge to the output of "perldoc -f
reverse", and you're home free;
foreach $key (reverse sort keys %hash) {
# blah blah blah
}
it's perhaps easier to think of it this way to start with (but it's much
more difficult to read once you understand what's happening);
foreach $key ( reverse(sort(keys(%hash))) ) {
# blah blah blah
}
alternatively, you could use a variation on the example given in
"perldoc -f keys", which uses the <=> operator inside a sort() block
(almost exactly what you want to do, I'd have thought). check the docs
for sort for more on that one if you're after a learning exercise.
or (I just noticed you've got the cookbook), swap the $a and $b round in
the last code snippet on pg 144, and you've got a descending
ascii-betical sort (which is what I was aluding to in the previous
paragraph).
happy now? ;)
P.S. have you noticed how similar the o'reilly books are to the online
docs yet?
--
Graham
P.S. <billynospam@mirror.bt.co.uk> is a fully working address...
------------------------------
Date: Mon, 09 Aug 1999 23:26:30 GMT
From: Jordan DeLozier <ionsearch@ionsearch.com>
Subject: Speed Up - Unexperienced
Message-Id: <37AF56C4.86A30900@ionsearch.com>
How can I speed up this code? I have these all over this one script and
it takes it about 20-30 seconds for only a flat file with a total of 80.
I know I've made some newbie mistakes, and I know you can speed it up
with while command, but how?
while (<new>) { chomp(???????????) etc..... Please, any help?
foreach $d (@new) {
chomp($d);
@mydata2 = split(/::/,$d);
if ($mydata2[5] eq "$categories[$finished]") {
if ($mydata2[6] == 100 || $mydata2[6] > 100) {
if ($mydata2[7] == 5) {
$join = join("::","$mydata2[6]","$mydata2[0]");
push(@xx,$join);
}
}
}
}
------------------------------
Date: Mon, 09 Aug 1999 22:20:03 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: Stopping someone from getting my cgi-scripts
Message-Id: <7onk4q$h81$1@xenon.inbe.net>
In article <37af4145.14042984@news.jps.net>, zorasterREMOVE@prontomail.com wrote:
[snip]
>My question is how can I stop him and other ppl from grabbing my
>cgi-scripts
Tell us which provider you're using now, and choose another...
Michel.
------------------------------
Date: 09 Aug 1999 17:36:18 -0500
From: Kent Perrier <kperrier@blkbox.com>
Subject: Re: Stopping someone from getting my cgi-scripts
Message-Id: <0CCADB92D1A6CDD8.F1FD7BAC10FDCF30.821CD65B0A9181ED@lp.airnews.net>
zorasterREMOVE@prontomail.com (Zoraster) writes:
>
> My question is how can I stop him and other ppl from grabbing my
> cgi-scripts
By correctly configuring your web server so that they cannot view
the directory that your cgi scripts are in. For more information go
look in a news group that deals with your web server.
Kent
------------------------------
Date: Tue, 10 Aug 1999 00:03:45 GMT
From: marcel.grunauer@lovely.net (Marcel Grunauer)
Subject: Re: Stopping someone from getting my cgi-scripts
Message-Id: <37b56bf1.17284193@enews.newsguy.com>
On Mon, 09 Aug 1999 21:03:06 GMT, zorasterREMOVE@prontomail.com
(Zoraster) wrote:
>A "friend" of mine is using some progrram or commands that allows
>him to view and copy all my cgi scripts off my website.
>
>I have read about this is some perl books, but it didn't explain how
>he was doing it od how to stop it. Other than be careful
>in writing your scripts.
>
>My question is how can I stop him and other ppl from grabbing my
>cgi-scripts
Sounds like your web server (or ISP's server) needs to be
reconfigured. Or did you give your friend your FTP password or
something like that? Anyway, it doesn't sound like a Perl problem (the
"friend" would probably just as easily be able to copy your CGI
programs if they were written in C), so get in touch with your ISP or
ask in a newsgroup related to the server.
Marcel
--
perl -e 'print unpack(q$u$,q$82G5S="!!;F]T:&5R(%!E<FP@2&%C:V5R$)'
------------------------------
Date: Mon, 09 Aug 1999 23:03:12 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: String compare
Message-Id: <Q6Jr3.4124$rR.3388@nsw.nnrp.telstra.net>
In article <37AE558C.C773B9AD@maths.uq.edu.au>,
chris <cmd@maths.uq.edu.au> writes:
> Do I win a holiday for two or something?
Not if that's all you could find wrong with it :)
Martien
--
Martien Verbruggen |
Interactive Media Division | Little girls, like butterflies, need no
Commercial Dynamics Pty. Ltd. | excuse - Lazarus Long
NSW, Australia |
------------------------------
Date: Mon, 9 Aug 1999 15:07:25 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Web Calendar Help.... !!!
Message-Id: <Pine.GSO.4.10.9908091501160.7774-100000@user2.teleport.com>
On Mon, 9 Aug 1999 vnova94@aol.com wrote:
> I have downloaded WebCal by Darryl Burgdorf:
> (http://awsd.com/scripts/webcal/index.shtml)
>
> I cannot get this script to run correctly.....
Have you complained to the author? Have you seen what the FAQ says in
section nine, under "My CGI script runs from the command line but not the
browser. Can you help me fix it?"
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 99)
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 V9 Issue 436
*************************************