[9534] in Perl-Users-Digest
Perl-Users Digest, Issue: 3128 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jul 11 14:07:12 1998
Date: Sat, 11 Jul 98 11:00:20 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 11 Jul 1998 Volume: 8 Number: 3128
Today's topics:
Re: Arrays - here's the code (The Wildman)
Re: Arrays - here's the code (The Wildman)
Re: Arrays - here's the code Grehom@my-dejanews.com
Re: Arrays - here's the code (The Wildman)
Re: BigEndian (long) to LittleEndian (Larry Rosler)
Re: can't control forks dow.jones@home.se
Free newsletter services [Was: Re: trigger sending a Fr lvirden@cas.org
Re: good research methods WAS Re: on the fly subs with lvirden@cas.org
hash's and a foreach - Can't do it? jevon@my-dejanews.com
How do I use perl for win95 in locally stored web pages <poohba@io.com>
Re: How do I use perl for win95 in locally stored web p <bowlin@sirius.com>
Re: MacPerl: Reading rsrc fork (Paul J. Schinder)
need a script (Degen-X)
Re: new charter and moderator for comp.lang.perl.announ lvirden@cas.org
Re: new charter and moderator for comp.lang.perl.announ lvirden@cas.org
Re: new charter and moderator for comp.lang.perl.announ lvirden@cas.org
Re: new charter and moderator for comp.lang.perl.announ <merlyn@stonehenge.com>
Re: new charter and moderator for comp.lang.perl.announ (Malcolm Hoar)
Re: new charter and moderator for comp.lang.perl.announ <rra@stanford.edu>
Re: number of days between two given dates using perl Grehom@my-dejanews.com
Re: Problems creating files merzky@physik.hu-berlin.de
Re: ptkdb Vers 1.032 Release Mistake (Andrew E Page)
PUZZLE: make hat, take ham <tchrist@mox.perl.com>
Q: waiting for a page respond, but maby it's wrong.. dwiesel@my-dejanews.com
Re: Question I can't find an answer for. Grehom@my-dejanews.com
Re: Question I can't find an answer for. jevon@my-dejanews.com
Re: remove the first k lines of a string Grehom@my-dejanews.com
Re: remove the first k lines of a string <merlyn@stonehenge.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 11 Jul 1998 15:10:00 GMT
From: the_wildman_98@hotmail.com (The Wildman)
Subject: Re: Arrays - here's the code
Message-Id: <slrn6qf0s5.sg9.the_wildman_98@foobar.net>
On 10 Jul 1998 23:40:44 -0400, Wildman's eyes rolled up in his head and
froth dripped from his fangs when Mark-Jason Dominus
<mjd@op.net> said the following fighting words:
>In article <6o5ns3$c82$1@monet.op.net>, Mark-Jason Dominus <mjd@op.net> wrote:
>
>>A related rule is: Use code to capture irregularity, and data to
>>capture regularity.
>
>Wheeee. It's the other way around, of course. You should encode the
>irregularities into some uniform data structure, and then have the
>code do the same things for every item in the data.
>
Okay. That makes a heck of a lot more sense. Thanks again.
--
The Wildman - wildman at microserve dot net
Do NOT reply to this post! All mail sent to the From/Reply-To will be
considered spam, and handled appropriately.
Fight spam - http://www.cauce.org/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS/MU d- s: a- C++ UL+ P+ L+++ !E W-- N+++ o !K w--- !O !M V-- PS PE Y+ PGP?
t+ 5+ X R tv b++ DI+ D++ G e h---- r++++ y++++
------END GEEK CODE BLOCK------
------------------------------
Date: 11 Jul 1998 15:33:00 GMT
From: the_wildman_98@hotmail.com (The Wildman)
Subject: Re: Arrays - here's the code
Message-Id: <slrn6qf275.sg9.the_wildman_98@foobar.net>
On 10 Jul 1998 20:23:18 -0400, Wildman's eyes rolled up in his head and
froth dripped from his fangs when Mark-Jason Dominus
<mjd@op.net> said the following fighting words:
>The Wildman <the_wildman_98@hotmail.com> wrote:
>>Really?!? All the examples in the docs I saw used eq.
>
>You're either mistaken, or you need to get new docs in a hurry.
I did say "docs I saw". I did not look at all of them, just the ones that I
thought relavent. Clearly, I did not look at enough of them.
>>I would *never* knowingly code in COBOL.
>
>I wasn't referring to the ==/eq thing when I wrote that. I was
>thinking that the event selector with thirty nearly identical lines
>looked to me like code written by COBOL programmers who were paid by
>the line.
Ah, I get it. I'm used to using switch and case in C, which perl does not
directly support. (In fact, it has much better ways to do it.)
>>That was beautifull. Someday I might understand it. How would I add in this?
>
>One way is to special-case it. Another is to combine your two
>100-sided dice into one 10,000-sided die and just use the same table
>technique. But you'd better understand it first if you're going to do
>that.
Hmmm... I think a special case would be more my speed. I was just wondering
if it would through a wrench into the works.
But ignoring that, there is one problem - the do/while loop... well...
loops. Indefinitely.
Here's the code again:
sub f113 {
my @used;
my ($i,$event_no);
for ($i = 0;$i < $events;$i++) {
do {
$dice = &roll(1,100);
my @max_dice = (0,5,10,20,23,25,27,31,34,37,38,41,44,48,50,53,
55,56,57,62,64,69,75,81,85,88,93,94,99,);
for ($event_no = 1;$event_no < @max_dice;$event_no++) {
($event_no,last) if $dice < $max_dice[$event_no];
}
} while $used[$event[$i]];
$used[$event[$i]] = 'yup';
print $i," ",$event_no,"\n";
$event[$i] = $event_no;
}
}
$dice would be 1 to 100. But I see that @max_dice is 0 to 99. And the loop
for $event_no is 1 to 98(?)
>>Unimaginably. This is for my web page and I'd be more than happy to give you
>>credit for improving my code. Just let me know how you'd like to be listed.
>
>Thanks, but that's not necessary.
>
Erm... well... okay. I like to give credit where it's due as much as
possible, but if you don't want it I understand. Sort of. :P
--
The Wildman - wildman at microserve dot net
Do NOT reply to this post! All mail sent to the From/Reply-To will be
considered spam, and handled appropriately.
Fight spam - http://www.cauce.org/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS/MU d- s: a- C++ UL+ P+ L+++ !E W-- N+++ o !K w--- !O !M V-- PS PE Y+ PGP?
t+ 5+ X R tv b++ DI+ D++ G e h---- r++++ y++++
------END GEEK CODE BLOCK------
------------------------------
Date: Sat, 11 Jul 1998 17:15:55 GMT
From: Grehom@my-dejanews.com
Subject: Re: Arrays - here's the code
Message-Id: <6o86ka$dci$1@nnrp1.dejanews.com>
lines like the following may cause problems
if ($dice eq 86)
better to say
if ($dice == 86)
if $dice is numeric - the 'eq' operator is for comparing strings!
In article <slrn6qc98a.ncp.the_wildman_98@foobar.net>,
the_wildman_98@hotmail.com wrote:
> If figured it might help if I showed the code that was causing trouble.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 11 Jul 1998 17:19:14 GMT
From: the_wildman_98@hotmail.com (The Wildman)
Subject: Re: Arrays - here's the code
Message-Id: <slrn6qf8ee.sg9.the_wildman_98@foobar.net>
On Sat, 11 Jul 1998 17:15:55 GMT, Wildman's eyes rolled up in his head and
froth dripped from his fangs when Grehom@my-dejanews.com
<Grehom@my-dejanews.com> said the following fighting words:
>lines like the following may cause problems
> if ($dice eq 86)
>better to say
> if ($dice == 86)
>if $dice is numeric - the 'eq' operator is for comparing strings!
Ah! Many thanks.
--
The Wildman
PLEASE do NOT reply to this post! If you MUST email me, please use wildman at
microserve dot net, but a followup is preferred. If you DO reply to the
wrong address, I'll still read it but don't expect a reply. Unless you are a
spammer, in which case I will reply to your ISP.
Fight spam - http://www.cauce.org/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS/MU d- s: a- C++ UL+ P+ L+++ !E W-- N+++ o !K w--- !O !M V-- PS PE Y+ PGP?
t+ 5+ X R tv b++ DI+ D++ G e h---- r++++ y++++
------END GEEK CODE BLOCK------
------------------------------
Date: Sat, 11 Jul 1998 06:06:41 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: BigEndian (long) to LittleEndian
Message-Id: <MPG.1011033a33cabbbf989730@nntp.hpl.hp.com>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
In article <35A7554D.E54DF42E@census.gov> on Sat, 11 Jul 1998 08:06:37 -
0400, Chris Stuber <cstuber@census.gov> says...
> I am reading binary data (long) into 4 bytes of a scalar...
> I know its big endian data, How do I convert into little endian?
> Does anyway have a subroutine to convert this mess?
I don't have a subroutine, but Perl has two functions.
$the_other_endian = unpack 'V', pack 'N', $one_endian;
Or you can switch the 'N' and the 'V' :-)
A crude test program:
#!/usr/local/bin/perl -w
use strict;
show(my $y = (1 << 24) + (2 << 16) + (3 << 8) + 4);
show(unpack 'V', pack 'N', $y);
show(unpack 'N', pack 'V', $y);
sub show {
my $z = shift;
print join(' ', ($z >> 24) & 0xFF, ($z >> 16) & 0xFF,
($z >> 8) & 0xFF, $z & 0xFF), "\n";
}
__END__
Output is:
1 2 3 4
4 3 2 1
4 3 2 1
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sat, 11 Jul 1998 16:27:37 GMT
From: dow.jones@home.se
Subject: Re: can't control forks
Message-Id: <6o83po$9k8$1@nnrp1.dejanews.com>
Hi again,
Let me try again... is this maby the correct way to wait for the child
processes to finish?
I still don't know how I can see if one child is taking to long time... so
please help me with that...
// Daniel
SOME CODE
=========
$number_of_forks = 0;
$SIG{CHLD} = sub { $number_of_forks--; wait; }
$number_of_forks = 9;
for (1..$number_of_forks)
{
$pid = fork;
$number_of_forks++;
# If child
if ($pid eq 0)
{
&do_something; # Look below...
}
}
while($ant_fork > 0)
{
sleep 1; # Is there a better solution???
}
In article <6o77e4$vfr$1@nnrp1.dejanews.com>,
dwiesel@my-dejanews.com wrote:
> Hallo
>
> I have a program where I'm forking a lot. And have two problems.
>
> 1. I don't know when the forks are done. 2. My subroutine &do_something is
> fetching a webpage and that webpage resides on another server which could be
> very slow. I don't want to wait forever. Maby a solution to that is to wait
> 30 seconds... Is there a better solution?
>
> I've heard that wait() and waitpid() exists but I'm not sure how to use
> them... I would appreciate if someone could give me an example.
>
> Thank you very much.
>
> // Daniel
>
> CODE SNIPPET
> ============
>
> $number_of_forks = 9;
>
> for (1..$number_of_forks)
> {
> # Create a new process
> $pid = fork;
>
> # If child
> if ($pid eq 0)
> {
>
> &do_something; #Could take very long time...
>
> }
> }
>
> &wait_until_all_forks_are_done;
>
> ...
>
> sub do_something
> {
> socket SOCKET, AF_INET, SOCK_STREAM, 0;
>
> if (connect SOCKET, sockaddr_in(80, inet_aton($domain)))
> {
> select SOCKET; $| = 1; select STDOUT;
>
> # This is the place where I don't want to wait forever for an
> answer...
> print SOCKET "GET $url\n\n";
>
> while ($rad = <SOCKET>)
> {
> $text .= $rad;
> }
>
> close SOCKET;
>
> &do_something_with_the_text;
> }
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 11 Jul 1998 16:15:21 GMT
From: lvirden@cas.org
Subject: Free newsletter services [Was: Re: trigger sending a Free Newsletter
Message-Id: <6o832p$qgb$1@srv38s4u.cas.org>
According to Dan Baker <dtbaker_@flash.net>:
:This is not a perl solution, but if you don't want to mess with the
:upkeep of the database, or sending bulk mail at all, you can accomplish
:the same thing by using NetMind to do it for you. I've used it on
:several websites, and it's a super way to let readers control their own
:notification when you update a page. check out http://www.netmind.com
:
And of course there are other sites as well. For instance, onelist.com
provides a moderated, announce only style mailing list that you can set
up. CommunityWare.com I believe it is has a newsletter feature that
goes out to the members of the appropriate web forum group, etc.
--
<URL:mailto:lvirden@cas.org> Quote: In heaven, there is no panic,
<*> O- <URL:http://www.teraform.com/%7Elvirden/> only planning.
Unless explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.
------------------------------
Date: 11 Jul 1998 15:42:20 GMT
From: lvirden@cas.org
Subject: Re: good research methods WAS Re: on the fly subs with special tag markers
Message-Id: <6o814s$o7c$1@srv38s4u.cas.org>
According to Mark Stang <mark$$$stang@ncgroup.com>:
:I fully expect to be flamed for this, but is there a cross referenced,
:indexed, searchable, hyperlinked version of the perl docs? I don't mean the
A PDF version of the doc is uploaded to CPAN on a pretty regular basis.
A Texinfo version of the doc occasionally shows up.
I also noticed, using altavista's advanced search and the search term
perl near winhelp this url
<URL:http://hytext.com/coolperl/update.html#perlhelp>
--
<URL:mailto:lvirden@cas.org> Quote: In heaven, there is no panic,
<*> O- <URL:http://www.teraform.com/%7Elvirden/> only planning.
Unless explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.
------------------------------
Date: Sat, 11 Jul 1998 14:56:24 GMT
From: jevon@my-dejanews.com
Subject: hash's and a foreach - Can't do it?
Message-Id: <6o7ueo$1qb$1@nnrp1.dejanews.com>
I would like to get some opinnions on how to append to a hash within a
foreach..
eg.
I would like to do this:
%items = (
$name => $value{$name}
);
but $value and $name are arrays. And I need to sort through them.. What I can
do in a foreach..
eg.
This is what I would think would work.
foreach $name (@name) {
%items = ($name => $value{$name})
}
I tried a push but I can't push a hash..
Any suggestions?
I know my technique is bad..
Thanks.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Sat, 11 Jul 1998 10:22:31 -0500
From: Chocolate <poohba@io.com>
Subject: How do I use perl for win95 in locally stored web pages?
Message-Id: <Pine.BSI.3.96.980711102025.28592A-100000@pentagon.io.com>
I am trying to test my cgi scripts at home before I put them on the net.
How do I do this?
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/ _/ _/
_/ _/ _/ _/
Web Page Designs _/_/_/ _/_/_/ _/_/_/ _/_/_/ _/_/_/ _/_/_/
Small Programs _/ _/ / _/ _/ _/ _/ _/ _/ _/ _/ poohba@io.com
www.io.com/~poohba _/ _/_/_/ _/_/_/ _/ _/ _/_/_/ _/_/\_ (919)506-5883
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
------------------------------
Date: Sat, 11 Jul 1998 10:47:31 -0700
From: Jim Bowlin <bowlin@sirius.com>
To: Chocolate <poohba@io.com>
Subject: Re: How do I use perl for win95 in locally stored web pages?
Message-Id: <35A7A533.8EE03E1F@sirius.com>
Chocolate wrote:
>
> I am trying to test my cgi scripts at home before I put them on the net.
> How do I do this?
Install a web server. Xitami is good and free and easy to install.
-- Jim Bowlin
------------------------------
Date: 11 Jul 1998 10:29:28 -0400
From: schinder@leprss.gsfc.nasa.gov (Paul J. Schinder)
Subject: Re: MacPerl: Reading rsrc fork
Message-Id: <6o7ss8$bfr@shell.clark.net>
In <6o6jjg$5o5$1@news1.bu.edu> macintsh@cs.bu.edu (John Siracusa) writes:
>Paul J. Schinder (schinder@leprss.gsfc.nasa.gov) wrote:
>: The key thing is to use the Fcntl::O_RSRC, which tells MacPerl to open
>: the resource fork instead of the data fork as a byte stream. Look at
>: my Mac::Conversions module, which you can find at
>: <http://pobox.com/~schinder/MacPerl.html> for a real life example,
>: converting MacBinary <=> native Mac files.
>Would you believe I recently wrote a MacBinary II routine myself?
>I looked on CPAN first. I guess I just must have missed your
>Mac::Conversions module. Ah well...
It's not in CPAN. At one point CPAN modules needed to be submitted as
.tar.gz, something I refuse to do for a MacPerl only module. I
haven't gotten around to determining if .tar.gz is still required.
Since it's available from my ftp site, putting it on CPAN is not a
high priority item for me. The module itself has been mentioned many
times on the MacPerl list.
>Anyway, thanks for the help!
>-----------------+----------------------------------------
> John Siracusa | If you only have a hammer, you tend to
> macintsh@bu.edu | see every problem as a nail. -- Maslow
--
--------
Paul J. Schinder
NASA Goddard Space Flight Center
schinder@leprss.gsfc.nasa.gov
------------------------------
Date: Sat, 11 Jul 1998 18:54:32 GMT
From: webmaster@trunzone.com (Degen-X)
Subject: need a script
Message-Id: <35a7b4c7.34943240@news.mindspring.com>
anyone have a script that records how many times a files has been
downloaded, then shows that number on your webpage?
Degen-X
http://www.trunzone.com
webmaster@trunzone.com
------------------------------
Date: 11 Jul 1998 15:55:23 GMT
From: lvirden@cas.org
Subject: Re: new charter and moderator for comp.lang.perl.announce
Message-Id: <6o81tb$otn$1@srv38s4u.cas.org>
According to Wolfgang Denk <wd@uebemc.siemens.de>:
:Randal Schwartz <merlyn@stonehenge.com> writes:
:>So, what do you think a new charter should permit/deny? Who do you
:>think should be moderator?
:
:Please do *NOT* allow commercial postings in c.l.p.a
And what is your definition of commercial posting?
I read flames on some usenet groups when a poster has the name of their
company in the signature area. I see folk call commercial announcements
of conferences. I see folk call commercial any announcement of CD-roms
that charge even a postage and handling fee.
Or are you just wanting to eliminate job postings , spam, etc.?
If O'Reilly's prints a hot new book on perl, is the announcement of it
banned from the group?
If Larry wants to announce a new release of the Perl Resource Kit, is it
refused? If Usenix is running a perl tutorial, is the announcement about
it rejected? If it costs postage to get a copy of someone's thesis on
a great new Perl application, is the announcement rejected?
I think whether one says 'allow commercial postings' or "don't allow them",
the parameters need to be defined.
--
<URL:mailto:lvirden@cas.org> Quote: In heaven, there is no panic,
<*> O- <URL:http://www.teraform.com/%7Elvirden/> only planning.
Unless explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.
------------------------------
Date: 11 Jul 1998 15:59:20 GMT
From: lvirden@cas.org
Subject: Re: new charter and moderator for comp.lang.perl.announce
Message-Id: <6o824o$p5b$1@srv38s4u.cas.org>
According to Daniel Grisinger <dgris@rand.dimensional.com>:
:The charter shouldn't bar anything for being commercial, but it
:should restrict _all_ postings to only those things that will
:be of direct use and benefit to perl programmers. Tools that make
:it easier to program and resources that allow us to become better
:perl programmers should be on-topic, regardless of whether somebody
:stands to make a financial gain on them.
What about Purify, used by Unix perl programmers to determine memory
leaks, etc.?
What about C compilers - used to _build_ the perl interpreter?
What about OS releases - needed to be in place as a base for perl?
If the OS is released with perl as a standard programming language
(ala Linux, etc.), does that make a difference?
What about commercial packages which either permit or exclusively use
perl as an extension language (Apache, Clearcase, etc.)?
Again - I am not leaning against or for commercial postings - just wanting
to see where folk want a line to be drawn.
--
<URL:mailto:lvirden@cas.org> Quote: In heaven, there is no panic,
<*> O- <URL:http://www.teraform.com/%7Elvirden/> only planning.
Unless explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.
------------------------------
Date: 11 Jul 1998 16:03:28 GMT
From: lvirden@cas.org
Subject: Re: new charter and moderator for comp.lang.perl.announce
Message-Id: <6o82cg$pkt$1@srv38s4u.cas.org>
According to Martien Verbruggen <mgjv@comdyn.com.au>:
:In article <5qk95o2emo.fsf@prometheus.frii.com>,
: Nathan Torkington <gnat@frii.com> writes:
:> cpierce1@cp500.fsic.ford.com (Clinton Pierce) writes:
:> Yes. If your product interfaces with Perl then you should be able to
:> post announcements of a new release to comp.lang.perl.announce. It's
:> not like there are thousands of programs that feature Perl. I hardly
:
:Please. Not that. We'll be inundated with announcements of every CGI
:program that is written in Perl. If you must allow commercial posting,
What about non-commercial CGI scripts? What is the purpose of the group?
To help those writing Perl programs? To help those using Perl use it
better? As a collection point so that someone who perhaps only has the
perl scripting language available for scripting to be able to find tools
to get their job done? Just curious.
Maybe what is necessary is a site where anything related to perl can
get cataloged, but the newsgroup is only used for programming related
tools?
--
<URL:mailto:lvirden@cas.org> Quote: In heaven, there is no panic,
<*> O- <URL:http://www.teraform.com/%7Elvirden/> only planning.
Unless explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.
------------------------------
Date: Sat, 11 Jul 1998 16:33:13 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: new charter and moderator for comp.lang.perl.announce
Message-Id: <8cpvfc73ga.fsf@gadget.cscaper.com>
>>>>> "Pat" == Pat Gunn <pgunn01@ibm.net> writes:
Pat> Raphael Manfredi wrote:
>> Better yet: have the moderator live in a place where such lawsuits
>> are not even remotely thinkable, not to say feasible. In France, for
>> instance, nobody in his right mind would attempt a lawsuit for that,
>> and I strongly doubt any judge would even let a trial happen.
Pat> Why not just have our theoretical moderator stick in the
Pat> charter that he accepts posts by his/her discretion, and
Pat> maybe that would dissuade potential lawsuits...
No, you seem to have that backwards. That's exactly the thing that
*invites* lawsuits.
<sigh>
print "Just another Perl newsgroup moderator,"
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Sat, 11 Jul 1998 16:38:31 GMT
From: malch@malch.com (Malcolm Hoar)
Subject: Re: new charter and moderator for comp.lang.perl.announce
Message-Id: <6o84e7$34g$1@nntp1.ba.best.com>
In article <6o0t0n$h3$2@comdyn.comdyn.com.au>, mgjv@comdyn.com.au (Martien Verbruggen) wrote:
>Please. Not that. We'll be inundated with announcements of every CGI
>program that is written in Perl. If you must allow commercial posting,
>please restrict them to products that have a direct relevance to Perl,
>the programming language, or perl, the program, or the perl community.
Agreed.
I am in favor of accepting on-topic commercial announcements. Of course,
others are not. So, I suggest that the moderator flag commercial
announcements in the Subject line so those who choose to can simply
configure their killfile accordingly.
--
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
| Malcolm Hoar "The more I practice, the luckier I get". |
| malch@malch.com Gary Player. |
| http://www.malch.com/ Shpx gur PQN. |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------
Date: 11 Jul 1998 10:10:26 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: new charter and moderator for comp.lang.perl.announce
Message-Id: <m3emvs48l9.fsf@windlord.Stanford.EDU>
lvirden <lvirden@cas.org> writes:
> What about Purify, used by Unix perl programmers to determine memory
> leaks, etc.?
No.
> What about C compilers - used to _build_ the perl interpreter?
No.
> What about OS releases - needed to be in place as a base for perl?
> If the OS is released with perl as a standard programming language
> (ala Linux, etc.), does that make a difference?
No.
> What about commercial packages which either permit or exclusively use
> perl as an extension language (Apache, Clearcase, etc.)?
Yes, but tagged. Whereas such things as announcements of conferences on
Perl, new books, and the like I wouldn't mind if they weren't even tagged.
Although there's something to be said for tagging *everything* with some
appropriate tag.
As for books, I'd say if it's a real book, approve it. Don't judge the
value of the book; lots of other people are willing to do that.
(My personal opinion.)
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Sat, 11 Jul 1998 17:28:14 GMT
From: Grehom@my-dejanews.com
Subject: Re: number of days between two given dates using perl
Message-Id: <6o87be$e68$1@nnrp1.dejanews.com>
could have a look at this - which came with my perl release 5.004_02 (WIN95)
#!perl -w
use strict;
no strict "vars";
use Date::DateCalc qw(decode_date date_to_short dates_difference);
print "\n";
$ok = 0;
while (! $ok)
{
print "Please enter the date of your birthday (day-month-year): ";
$date = <STDIN>;
print "\n";
if (($yy1,$mm1,$dd1) = decode_date($date))
{
$datestr = date_to_short($yy1,$mm1,$dd1);
print "Your date is: $datestr\n";
print "\n";
print "Is that correct? (Yes/No) ";
$response = <STDIN>;
print "\n";
$ok = ($response =~ /^Y/i);
}
}
print "Your birthday is: $datestr\n";
print "\n";
$ok = 0;
while (! $ok)
{
print "Please enter today's date (day-month-year): ";
$date = <STDIN>;
print "\n";
if (($yy2,$mm2,$dd2) = decode_date($date))
{
$datestr = date_to_short($yy2,$mm2,$dd2);
print "Your date is: $datestr\n";
print "\n";
print "Is that correct? (Yes/No) ";
$response = <STDIN>;
print "\n";
$ok = ($response =~ /^Y/i);
}
}
print "Today's date is: $datestr\n";
print "\n";
$days = dates_difference($yy1,$mm1,$dd1,$yy2,$mm2,$dd2);
print "You are $days days old.\n";
print "\n";
__END__
In article <6o5kdo$q86$1@nnrp1.dejanews.com>,
santhi@my-dejanews.com wrote:
> I have to calculate the number of days in between two given dates in certain
> format.( 07/10/98, 05/30/98 ) Is there any Perl module written for that, or I
> have to write my own function? Please help me.
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Sat, 11 Jul 1998 14:19:24 GMT
From: merzky@physik.hu-berlin.de
Subject: Re: Problems creating files
Message-Id: <6o7s9c$uq2$1@nnrp1.dejanews.com>
In article <35a63d46.0@news.arrakis.es>,
"Guillermo Garcis" <ggarces@arrakis.es> wrote:
> I can4t create files putting: open NEW, "+>$PAGE" or die "Error
> opening$PAGE\n$!";
> i don4t know if the name is too long or i have to give permissions.
> I tried too: open NEW, ">$PAGE" or die "Error opening $PAGE\n$!"; but it
> don4t works....
> When i try to create files appears the next error: Permission denied
> What i have to do?
> Thanks.
>
You probably are not allowed to open file in the current directory.
You could use '/tmp' for instance:
open NEW, "+>/tmp/$PAGE" or die "Error opening '/tmp/$PAGE'\n$!";
Take care not to use filenames of existing files (if you do not own them
it will fail again...), and to use valid filenames.
Hope this helps..
Andre.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Sat, 11 Jul 1998 14:03:56 GMT
From: aep@world.std.com (Andrew E Page)
Subject: Re: ptkdb Vers 1.032 Release Mistake
Message-Id: <EvxoEL.Gn0@world.std.com>
My apologies to all.
I made a mistake in prepping the release of ptkdb. The installer
had the correct version(install_ptkdb.pl), but somehow I didn't get
the correct version of the standalone module(ptkdb.pm) into the
download area.
The version number in the "File -> About" dialog is correct so
you can check there if you're not sure.
If you used install_ptkdb.pl, you're fine. If you got ptkdb.pm,
and you want version 1.032 go back to the web site and the propper
version is there.
--
Andrew E. Page (Warrior Poet) | Decision and Effort The Archer and Arrow
Software Engineering Consultant | The difference between what we are
Unix, Mac, C/C++/Java, Perl, NT | and what we want to be.
------------------------------
Date: 11 Jul 1998 13:46:49 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: PUZZLE: make hat, take ham
Message-Id: <6o7qc9$97a$1@csnews.cs.colorado.edu>
Here's a puzzle for you.
Take a list of words and produce two sets of matching word pairs such
that "Xaaa bbbY" and "Yaaa bbbX" are all 4 legal words from that list.
For example: "make hat" and "take ham". In other words, you have to
exchange the first letter of the first word with the last letter of
the last word. For example: "make hat" and "take ham" are one set of
such pairs.
Now, find all such matching pairs in the list, and do this in better than
exponential time. The goal is to run this over a large /usr/dict/words.
--tom
--
"Every normal man must be tempted at times to spit on his
hands, hoist the black flag, and begin slitting throats."
--H.L. Mencken
------------------------------
Date: Sat, 11 Jul 1998 16:51:22 GMT
From: dwiesel@my-dejanews.com
Subject: Q: waiting for a page respond, but maby it's wrong..
Message-Id: <6o856a$b7r$1@nnrp1.dejanews.com>
Hi,
How do I know if the page I'm waiting for takes to long time, maby because
it's a program that has a bug or some other reson...
I don't want to wait forever...
Thank you
// Daniel
SOME CODE
=========
socket SOCKET, AF_INET, SOCK_STREAM, 0 or die "error";
if (connect SOCKET, sockaddr_in(80, inet_aton("$host")))
{
select SOCKET; $| = 1;
select STDOUT;
print SOCKET "GET $a_cgi_script\n\n";
# I think this is the place where the program waits for an answer
# I don't want to wait forever.... how do I know that something is
# wrong?
while ($rad = <SOCKET>)
{
$text .= $rad;
}
}
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Sat, 11 Jul 1998 15:45:53 GMT
From: Grehom@my-dejanews.com
Subject: Re: Question I can't find an answer for.
Message-Id: <6o81bh$5vl$1@nnrp1.dejanews.com>
Have a look at some of the examples downloadable from 'The Perl Journal' (see
following reference):
http://orwant.www.media.mit.edu/tpj/programs/Issue_1_HTMLregexps/
the article mentioned a Perl module called something like 'www...' which
contains a whole bunch of ready to use routines for doing same sort of thing
you are looking at!
<6o3ng0$3t9$1@nnrp1.dejanews.com>,
jevon@my-dejanews.com wrote:
> I have just begun to script in perl. I am trying to make a CGI application
> (This is a perl question) that will replace all instances of $name with $value
> {$name} in a template HTML file.
>
> I beleive this should be able to be done in two foreach loops
>
> I have read the template file into the @lines variable
> eg.
>
> foreach $lines (@lines) {
> foreach $name (@name) {
> ($line) = $lines =~ s/$name/$value{$name}/ig;
> }
> }
>
> Can anyone help me.
>
> I short I just want to read in a form and replace any occurances of a form
> feild's name with it's value..
>
> Thanks.
>
> Jevon.
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Sat, 11 Jul 1998 17:03:01 GMT
From: jevon@my-dejanews.com
Subject: Re: Question I can't find an answer for.
Message-Id: <6o85s5$c4c$1@nnrp1.dejanews.com>
In article <6o81bh$5vl$1@nnrp1.dejanews.com>,
Grehom@my-dejanews.com wrote:
> Have a look at some of the examples downloadable from 'The Perl Journal' (see
> following reference):
>
> http://orwant.www.media.mit.edu/tpj/programs/Issue_1_HTMLregexps/
>
> the article mentioned a Perl module called something like 'www...' which
> contains a whole bunch of ready to use routines for doing same sort of thing
> you are looking at!
>
Thanks.. I'll check it out.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Sat, 11 Jul 1998 16:47:13 GMT
From: Grehom@my-dejanews.com
Subject: Re: remove the first k lines of a string
Message-Id: <6o84uh$b40$1@nnrp1.dejanews.com>
Could try something like:
#!/usr/bin/perl -w
use strict;
my ($str);
$str = "1st\n2nd\n3rd\n4th\n5th\n";
$str =~ s/^ # start at beginning of string
(.*\n) # match zero or more character followed by a new line
{3}? # do a minimal match on just three of the () expression
//x; # replace the first three lines with nothing
# the 'x' signifies that the regex can be split up
# could equally well written substitution as
# $str =~ s/^(.*\n){3}?//; # but then we'd have lost my comments about regex
print $str;
<>;
In article <6o4mcu$c4r@eng-ser1.erg.cuhk.edu.hk>,
Database and tools for Uniweb <uwtools@cse.cuhk.edu.hk> wrote:
> I have a string consisting of certain number of lines. I want to remove
> the first k lines from it.
>
> E.g., $str = "1st\n2nd\n3rd\n4th\n5th\n";
>
> after removal of the first 3 lines, $str eq "4th\n5th\n";
>
> Thank you.
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Sat, 11 Jul 1998 17:53:03 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: remove the first k lines of a string
Message-Id: <8chg0o6zr9.fsf@gadget.cscaper.com>
>>>>> "Grehom" == Grehom <Grehom@my-dejanews.com> writes:
Grehom> {3}? # do a minimal match on just three of the () expression
If something can match from 3 to 3 times. It doesn't matter whether
it picks 3 (the minimum) or 3 (the maximum) does it?
I'm puzzled by why you might think ? makes sense after a range with no
range.
print "Just another Perl hacker," =~ /(.+)+?/
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
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 3128
**************************************