[16107] in Perl-Users-Digest
Perl-Users Digest, Issue: 3519 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 30 00:15:43 2000
Date: Thu, 29 Jun 2000 21:15:14 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <962338514-v9-i3519@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 29 Jun 2000 Volume: 9 Number: 3519
Today's topics:
Re: deleting entries in a hash <bwalton@rochester.rr.com>
Re: Getting data back from another application <juex@deja.com>
Re: Golf problem (Craig Berry)
help required <editor@football-europe.com>
Re: Help with hashes (Tad McClellan)
Re: Hot swap modules without shutdown <johnlin@chttl.com.tw>
how do i create an array of hashes? <TheEx0rcist@fanclub.org>
Re: how do i create an array of hashes? <bwalton@rochester.rr.com>
Re: how do i create an array of hashes? <stephenk@cc.gatech.edu>
Re: how do i create an array of hashes? (Tad McClellan)
Is there a way for perl to alarm() or sleep() for less <japh@flashmail.com>
Re: Keeping track of open files <peter.sundstrom@eds.com>
Re: Load a HTML-File on another server <juex@deja.com>
Re: Load a HTML-File on another server (Abigail)
Re: Message Board Problem (Clinton A. Pierce)
Re: Net::FTP not on CPAN <elaine@chaos.wustl.edu>
Newbie: how to split one string to many where there's a <someguy@nospamland.com>
Re: Newbie: how to split one string to many where there <jeffp@crusoe.net>
Perl & Apache Books for sale by O'Reilly! Also Python & <scott@lund.com>
Perl Help! malverian@my-deja.com
Re: Perl Help! (Jon Bell)
Re: String Cat Confussion <dsbryant@worldnet.att.net>
Re: Teen Volenteers WANTED <elaine@chaos.wustl.edu>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 30 Jun 2000 02:11:28 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: deleting entries in a hash
Message-Id: <395C00BC.5EB6BE93@rochester.rr.com>
Paulo Dutra wrote:
>
> I have hash in which I want delete entries as I iterate through.
> I create copy of the original, so as not destroy the original data.
>
> As I iterate through the entries, and make selective deletions
> from %avbl_temp, this also deletes entries from the reference $avbl.
>
> This sits in a for loop, so on each iteration I want to copy the
> original data back to the working hash keys. This is simplified
> from what I'm really doing. So how do I maintain the original
> data set from being deleted while working on the copy of it?
>
> for (n = 0; .....)
> {
> # Copy listing to a temporary working copy
> my(%avbl_temp) = %$avbl;
>
> delete $avbl_temp{'key'};
>
> }
>
> --
> Paulo //\\\\
...
Hmmm...I don't have any problem with the original hash and the copy
getting confused, as evidenced by this test code:
use Data::Dumper;
$href={k1=>'v1',k2=>'v2',k3=>'v3'};
%h=%$href;
delete $h{k2};
print Dumper(\%h);
print Dumper($href);
Perhaps it is something else that is actually wrong with your code?
--
Bob Walton
------------------------------
Date: Thu, 29 Jun 2000 18:09:30 -0700
From: "Jürgen Exner" <juex@deja.com>
Subject: Re: Getting data back from another application
Message-Id: <395bf351$1@news.microsoft.com>
"Tad McClellan" <tadmc@metronet.com> wrote in message
news:slrn8lnhev.4iq.tadmc@magna.metronet.com...
> On Thu, 29 Jun 2000 13:56:40 -0500, Jordan Bohm <bohmj@mrs.umn.edu> wrote:
>
> >I have a perl program that grabs ip addresses from people that visit my
> >site. While this lets me know if the same people are hitting my site I
> You don't really believe that, do you?
[...]
> A single computer (e.g. firewall) may have thousands of
> different people all using the same IP.
Not to mention that the same user may use different IP addresses, e.g. when
using a dial-up connection to his ISP.
jue
------------------------------
Date: Fri, 30 Jun 2000 01:17:58 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Golf problem
Message-Id: <slnta6pmjev21@corp.supernews.com>
Peter Marksteiner (hump@katz.cc.univie.ac.at) wrote:
: Suppose you want to find words with exactly ten non-repeating letters such
: as "binoculars", "fishmonger", or "paintbrush", suitable for games or simple
: encryption of numbers where every decimal digit is represented by a letter.
:
: I've tried to write the shortest possible Perl program to extract
: such words from a wordlist and have found the following two solutions:
:
: perl -pe '%c=();length==11&!grep{$c{$_}++}split""or$_=""' /usr/dict/words
: perl -pe '$_=""if(keys%{{map{$_,1}split""}})*length!=121' /usr/dict/words
:
: Is there anybody who can do it with fewer keystrokes?
perl -pe 'length==11&&\!/(.).*\1/ or$_=""' /usr/dict/words
--
| Craig Berry - http://www.cinenet.net/users/cberry/home.html
--*-- "Beauty and strength, leaping laughter and delicious
| languor, force and fire, are of us." - Liber AL II:20
------------------------------
Date: Fri, 30 Jun 2000 04:23:54 +0100
From: "dave jeffcoat" <editor@football-europe.com>
Subject: help required
Message-Id: <395c0618$1_2@einstien.netscapeonline.co.uk>
Hello everyone.
I was hoping someone out there could help out!!!
I am the owner of a soccer site.
I am looking for someone, either with experience or with the knowledge, to
create generic web pages from news feed sent by a news agency to folders on
the site's server via FTP.
Currently, the news is updated MANUALLY, downloading the files and copying
and pasting the relevant stuff onto web pages.
Quite a tiresome process.
As the site is growing, this needs to be done with the use of PERL scripts
so I can spend more time working on other content.
IF anyone is interested, or know anyone who might be, please contact me at
davejeffcoat@netscapeonline.co.uk. Please give details as to the payment
you might expect.
THANK YOU.
------------------------------
Date: Thu, 29 Jun 2000 21:14:33 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Help with hashes
Message-Id: <slrn8lnt3p.4rr.tadmc@magna.metronet.com>
[ Jeopardectomy performed ]
On Thu, 29 Jun 2000 15:48:38 -0600, Colby Hansen <cghansen@micron.com> wrote:
>
>Drew Simonis wrote in message <395BAD96.F245BD0C@attglobal.net>...
>>Colby Hansen wrote:
>>>
>>> By the way, how old are you???
>>
>>Heheh. I recall from previous posts that Mr. McClellan is a fully
>>grown adult, and may even be a geezer!
>Probably... I just took offense to what he wrote to me...
What did you take offense at?
I cannot see anything offensive there. If you point out were
I did it, I'll try and not do it again.
Do you claim that it is not a waste of time to review code
that does not exist?
What does age have to do with it?
Do young people not mind wasting time, and old people do?
Or do old people not mind wasting time, and young people do?
I am not getting your point.
Sorry.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 30 Jun 2000 10:44:11 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: Re: Hot swap modules without shutdown
Message-Id: <8jh1dm$j64@netnews.hinet.net>
"Dr. Peter Dintelmann" wrote
> John Lin schrieb
> >That is, without shutting down the main program, can I unload
> >a module and then reload the module of a modified version?
>
> of course. The key point is %INC which keeps track
> on all loaded modules. Thus to get rid of (i.e. "unrequire")
> a module Module.pm you
>
> delete $INC{'Module.pm'};
>
> Now perl thinks the module is not yet loaded and you can
> require it again.
Yes, I substitute the line eval "no ModelX";
with delete $INC{'ModelX.pm'}; and get the result:
ModelX version 1.0
Now modify ModelX without shutting down main program
Press Enter to continue...
ModelX version 2.0
Subroutine new redefined at ModelX.pm line 2, <> line 1.
Subroutine hello redefined at ModelX.pm line 3, <> line 1.
That is, re-require ModelX was achieved.
As for the warning messages, do they mean to warn us
about anything that could be seriously dangerous?
Thank you.
John Lin
------------------------------
Date: Fri, 30 Jun 2000 03:45:37 +0200
From: "TheEx0rcist" <TheEx0rcist@fanclub.org>
Subject: how do i create an array of hashes?
Message-Id: <8jgu3j$16th$1@news6.isdnet.net>
how do i create an array of hashes?
thanks !
------------------------------
Date: Fri, 30 Jun 2000 01:56:51 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: how do i create an array of hashes?
Message-Id: <395BFD4F.3CB6DF33@rochester.rr.com>
TheEx0rcist wrote:
>
> how do i create an array of hashes?
...
One way:
@a=({k1=>'v1',k2=>'v2},{k3=>'v3',k4=>'v4'});
Actually, that is an array of hash references, which is as close as you
will get to what you stated, since an array element holds scalars , not
hashes, as its value (a reference being an example of a scalar).
For more info, see
perldoc perlref
perldoc perldata
--
Bob Walton
------------------------------
Date: Thu, 29 Jun 2000 21:57:55 -0400
From: Stephen Kloder <stephenk@cc.gatech.edu>
Subject: Re: how do i create an array of hashes?
Message-Id: <395BFEA3.4FF26C1E@cc.gatech.edu>
TheEx0rcist wrote:
> how do i create an array of hashes?
>
> thanks !
The question "How can I make the Perl equivalent of a C structure/C++
class/hash or array of hashes or arrays?" appears in perlfaq4.
--
Stephen Kloder | "I say what it occurs to me to say.
stephenk@cc.gatech.edu | More I cannot say."
Phone 404-874-6584 | -- The Man in the Shack
ICQ #65153895 | be :- think.
------------------------------
Date: Thu, 29 Jun 2000 21:39:00 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: how do i create an array of hashes?
Message-Id: <slrn8lnuhk.50o.tadmc@magna.metronet.com>
On Fri, 30 Jun 2000 03:45:37 +0200, TheEx0rcist <TheEx0rcist@fanclub.org> wrote:
>how do i create an array of hashes?
------------------
#!/usr/bin/perl -w
use strict;
use Data::Dumper;
my $ref_to_LoH = [ { } ];
print Dumper $ref_to_LoH;
------------------
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 29 Jun 2000 22:59:20 -0500
From: Flounder <japh@flashmail.com>
Subject: Is there a way for perl to alarm() or sleep() for less than a second
Message-Id: <395C1B18.EFFC9C88@flashmail.com>
Is there a way to send a sigalrm or sleep() in less than a second like
a half a second. alarm() and sleep() go by seconds i need milliseconds
:-(
Thanks,
--
Flounder
>+++++++[<++++++++++>-]<++++.---------.+.++++.++.
------------------------------
Date: Fri, 30 Jun 2000 14:02:45 +1200
From: "Peter Sundstrom" <peter.sundstrom@eds.com>
Subject: Re: Keeping track of open files
Message-Id: <8jgv76$e2h$1@hermes.nz.eds.com>
Abigail wrote in message ...
>Peter Sundstrom (peter.sundstrom@eds.com) wrote on MMCDXCIII September
>MCMXCIII in <URL:news:8je22q$phv$1@hermes.nz.eds.com>:
>() What's the best way to handle keeping track of what files have been
opened?
>()
>() I have a set of input data that determines what the name of the output
file
>() will be. The number and name of the output files will vary with each
new
>() set of input data.
>()
>() Once I've opened my output file using a variable filehandle, I'll be
writing
>() data to it. I need to make sure that I only open the file once.
>() I was thinking of something like creating a hash of the filehandles and
>() doing a check to see if I need to open the file before writing to it,
eg:
>()
>() if (! defined $filehandle{$filename}) {
>() open $filehandle{$filename}, ">$filename" or die "Can not write to
>() $filename $!\n";
>() }
>()
>() print $filehandle{$filename} "$somedata";
>()
>() Is there a better way to do this?
>
>
>I would use IO::File by subclassing it, and then strictly use that
>subclass to open and access files.
I'm not sure what you mean. Are you able to supply a code sample?
------------------------------
Date: Thu, 29 Jun 2000 18:11:21 -0700
From: "Jürgen Exner" <juex@deja.com>
Subject: Re: Load a HTML-File on another server
Message-Id: <395bf3b9$1@news.microsoft.com>
"Matthias Keller" <matti@keller.com> wrote in message
news:395BF26F.131DDB98@keller.com...
> Is it possible to redirect a browser to another HTML-File on another
> server?
Sure, I'm just typing the new URL in the adress bar and hit enter.
What was your Perl question?
jue
------------------------------
Date: 29 Jun 2000 23:01:50 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: Load a HTML-File on another server
Message-Id: <slrn8lo4ep.ka1.abigail@alexandra.delanet.com>
Matthias Keller (matti@keller.com) wrote on MMCDXCV September MCMXCIII in
<URL:news:395BF26F.131DDB98@keller.com>:
\\
\\ Is it possible to redirect a browser to another HTML-File on another
\\ server?
And your Perl input is.... ?
Abigail
--
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'
------------------------------
Date: Fri, 30 Jun 2000 02:04:25 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: Message Board Problem
Message-Id: <JeT65.14493$fR2.172028@news1.rdc1.mi.home.com>
[Posted and mailed]
In article <20000629182233.02054.00000877@ng-ch1.aol.com>,
canon50e@aol.comDELETE (Kar Yan Mak) writes:
> Hi, there's a problem with my message board and I'm not sure where to start
> correcting it. I got the script from Matt's Script Archive.
> [...]
What a trash heap.
> Anyone know where I can start checking?
What's your Perl question? Learn Perl, start debugging.
Good luck wading through that nasty mess of code.
--
Clinton A. Pierce Teach Yourself Perl in 24 Hours!
clintp@geeksalad.org for details see http://www.geeksalad.org
"If you rush a Miracle Man,
you get rotten Miracles." --Miracle Max, The Princess Bride
------------------------------
Date: Fri, 30 Jun 2000 03:29:24 GMT
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: Net::FTP not on CPAN
Message-Id: <395C1412.DAEED6BC@chaos.wustl.edu>
Jonathan Stowe wrote:
> Yeah but it gets mentioned here every week and has been mooted as a FAQ
> by some - a judicious search of Deja News would have given it to you ...
PEBKAC :)
e.
------------------------------
Date: Fri, 30 Jun 2000 11:22:53 +0800
From: "Tony" <someguy@nospamland.com>
Subject: Newbie: how to split one string to many where there's a space
Message-Id: <395c1226@news02.imsbiz.com>
I would like to split up one string into many.
Example: If the string is "how are you doing" , I would like to split it up
where there's a space to 4 strings- "how", "are", "you", "doing" . I'm new
to Perl so would appreciate any help, or you could just point me to some
site.
Thanks.
------------------------------
Date: Thu, 29 Jun 2000 23:27:51 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Newbie: how to split one string to many where there's a space
Message-Id: <Pine.GSO.4.21.0006292326190.7544-100000@crusoe.crusoe.net>
[posted & mailed]
On Jun 30, Tony said:
>I would like to split up one string into many.
Oddly enough, Perl has a function called split() to do JUST that.
>Example: If the string is "how are you doing" , I would like to split it up
>where there's a space to 4 strings- "how", "are", "you", "doing" . I'm new
>to Perl so would appreciate any help, or you could just point me to some
>site.
If you have perl installed, then type:
perldoc -f split
If you don't, go to http://www.perl.com/ and go to the online
documentation.
A simple use of split() is:
@non_whitespace_strings = split ' ', $string;
--
Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/
PerlMonth - An Online Perl Magazine http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc. http://www.perlarchive.com/
CPAN - #1 Perl Resource (my id: PINYAN) http://search.cpan.org/
------------------------------
Date: Thu, 29 Jun 2000 19:16:49 -0700
From: Scott Chapman <scott@lund.com>
Subject: Perl & Apache Books for sale by O'Reilly! Also Python & PHP!
Message-Id: <dj0olsgpcg1ks22e3aiu87dmiounpsq99d@4ax.com>
I have one each of the following books for sale in excellent
condition:
Writing Apache Modules with Perl and C $32.00
Programming Perl 2nd Edition $33.00
Perl Cookbook $30.00
Advanced Perl Programming $20.00
Learning Perl 2nd Edition $22.00
Apache The Definitive Guidew/CD $25.00
Shipping: US Mail. Actual costs.
You tell me how fast you want 'em.
Also:
Core PHP Programming $30.00
Programming Python w/CD $30.00
Preferred payment via PayPal. Please inquire if interested.
scott@lund.com
These prices are better than Amazon's!
------------------------------
Date: Fri, 30 Jun 2000 01:07:52 GMT
From: malverian@my-deja.com
Subject: Perl Help!
Message-Id: <8jgrsv$8dk$1@nnrp1.deja.com>
Okay... maybe I finally got your attention. The last message I sent is
about 8 pages back now, I have a very simple question, if you can
answer it.. or half answer it I would be very happy.
[[ Where can I get a functioning chat server made in Perl for Win32, or
can some one get me started on how to make one? ]]
That's that, if anyone can help in the smallest of ways, it's better
than nothing.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 30 Jun 2000 03:45:14 GMT
From: jtbell@presby.edu (Jon Bell)
Subject: Re: Perl Help!
Message-Id: <Fwy7rF.F9K@presby.edu>
In article <8jgrsv$8dk$1@nnrp1.deja.com>, <malverian@my-deja.com> wrote:
>
>[[ Where can I get a functioning chat server made in Perl for Win32, or
>can some one get me started on how to make one? ]]
Go to http://google.com/ and enter "Perl chat server" into the search
box.
--
Jon Bell <jtbell@presby.edu> Presbyterian College
Dept. of Physics and Computer Science Clinton, South Carolina USA
[ Questions about newsgroups? Visit http://www.geocities.com/nnqweb/ ]
[ or ask in news:news.newusers.questions ]
------------------------------
Date: Fri, 30 Jun 2000 02:40:32 GMT
From: "Don Bryant" <dsbryant@worldnet.att.net>
Subject: Re: String Cat Confussion
Message-Id: <AMT65.8360$AM4.513549@bgtnsc04-news.ops.worldnet.att.net>
> don_bryant@my-deja.com wrote in message <8jfrt0$f5v$1@nnrp1.deja.com>...
> >Please consider the following:
> >
> >my $string1="/export/home/";
> >my $string2="00-06-30";
> >my $new_path="";
> >
> >$new_path= join $new_path, $string1, $string2, "/";
> >
> Just use
>
> my $new_path="$string1$string2/";
>
>
Thank your Peter and everyone for checking my code snippet. The machine that
this code fails on is running Linux 6.2 Perl 5.05. My Linux server at home
runs the code correctly and so do my Active Perl installs on two different
Windows boxes. Really wierd!
Thanks again.
Don Bryant
Senior Programmer
Healtheon WebMD
------------------------------
Date: Fri, 30 Jun 2000 03:31:08 GMT
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: Teen Volenteers WANTED
Message-Id: <395C147B.16A7BD0@chaos.wustl.edu>
jb wrote:
> > I am... and judging from how you adults are flaming, I think I'll stay a
> > teenager...
>
> I believe you will find this is impossible.
Yes, especially since most people on c.l.p.m. behave like they have aged
backwards to the age of 8 or so. :)
e.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 3519
**************************************