[12090] in Perl-Users-Digest
Perl-Users Digest, Issue: 5690 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun May 16 22:07:13 1999
Date: Sun, 16 May 99 19:00:18 -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 Sun, 16 May 1999 Volume: 8 Number: 5690
Today's topics:
__END__ in eval (Jed Parsons)
Re: comp.lang.perl.* archive? (Bob Trieger)
Re: counting lines in another file (Bob Trieger)
Duplicate Line - ignoring second line of text <rbruno@mindspring.com>
Re: EASY MONEY <webmaster@chatbase.com>
MacPerl bsharvyNOSPAM@efn.org
Re: Microsoft IIS4 (Bob Trieger)
Re: Modify this Penpal script for better use <webmaster@chatbase.com>
Re: Modules??? (Tad McClellan)
Re: MS-HTML must die! <cassell@mail.cor.epa.gov>
Re: Off-topic: France (was Re: Perl "constructors") (Bob Trieger)
Re: open, read,then print a file armchair@my-dejanews.com
Re: opportunity in Boston-based internet start-up <webmaster@chatbase.com>
Re: Perl "constructors" armchair@my-dejanews.com
Re: Perl "constructors" (Alan Curry)
Re: Perl "constructors" (Michael Stillwell)
Re: perltootc - OO Tutorial for Class Data in Perl <webmaster@chatbase.com>
Re: Sorting of array of hashes. (Charles R. Thompson)
Strange file reading problem <dlent1@uic.edu>
Re: Strange file reading problem <jdf@pobox.com>
use array as keys in a hash <jbell@263.net>
Re: use array as keys in a hash (Sam Holden)
Wanted a email script for message board (anonymous)
Where to install DB_File (tied hash) in distributed mod <bhuston@eden.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 16 May 1999 23:54:56 GMT
From: jed@socrates.berkeley.edu (Jed Parsons)
Subject: __END__ in eval
Message-Id: <7hnlsg$fnn$1@agate.berkeley.edu>
Greetings:
I'm trying to slurp some perl code out of another file and run it. If
I eval this code, it halts at __END__ without reading any DATA. For
example, if I run this script:
open (FILE,"file");
while (<FILE>) {
$code .= $_; # this is simplified for the sake of example
}
eval $code;
on this file:
for (<DATA>) { print; }
__END__
Hello!
I get nothing. Can anyone help out?
Many thanks,
Jed
--
Jed Parsons jed@socrates.berkeley.edu
http://www.ocf.berkeley.edu/~jparsons/
----------------------------------------------------------
grep(do{for(ord){(!$_&&print"$s\n")||(($O+=(($_-1)%6+1)and
------------------------------
Date: Sun, 16 May 1999 23:37:20 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: comp.lang.perl.* archive?
Message-Id: <7hnjk9$o7i$1@holly.prod.itd.earthlink.net>
[ courtesy cc sent by mail if address not munged ]
Jay Flaherty <fty@utk.edu> wrote:
>Pavel Kotala wrote:
>>
>> Exists any way to explore historical news? I am biginner in discussion
>> groups.
>>
>> Thank you
>>
>> Pavel Kotala
>
>www.dejanews.com
Actually, they changed their url last week.It's http://www.deja.com now.
------------------------------
Date: Sun, 16 May 1999 23:46:05 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: counting lines in another file
Message-Id: <7hnk4m$o7i$2@holly.prod.itd.earthlink.net>
[ courtesy cc sent by mail if address not munged ]
"J|rgen Exner" <juex@my-dejanews.com> wrote:
>Bjorn De Waele <bjorn.de.waele@skynet.be> wrote in message
>news:7hmea0$jab$1@news1.skynet.be...
>> I've got a textfile called address.txt which contains very much lines with
>> e-mailaddresses in. I need to now automatically how much lines there are
>in
>> that text-file. How do I need to do this ?
>
>No need to launch Perl for this rather trivial task, just use wc (word
>count):
> wc -l address.txt
C:\>wc -l testdata.txt
Bad command or file name
is one good reason why.
He never said he was on Unix and this a perl newsgroup so chances are he
wanted a perl answer, not a *nix-centric one.
------------------------------
Date: Sun, 16 May 1999 21:23:32 -0400
From: "Robert Bruno" <rbruno@mindspring.com>
Subject: Duplicate Line - ignoring second line of text
Message-Id: <7hnqvt$q43$1@nntp8.atl.mindspring.net>
How do I have the write the code to ignore the second line of text since
it is a duplicate of the first line? Also, I want the string to selectively
take data from the line. My hunch was to match the code outright,
however, I don't want to parse the duplicate line.
---- NUMBER OF PRIMARY CALLS -----
TIME OFFRD HAND OTHER ABAND
---------------------------------------------------------------
10:30-10:59 205 190 3 10 95.0 5.0
10:30-10:59 205 190 3 10 95.0 5.0
Please help.
------------------------------
Date: Sun, 16 May 1999 17:51:07 -0700
From: TRG Software : Tim Greer <webmaster@chatbase.com>
Subject: Re: EASY MONEY
Message-Id: <373F67FB.6A5478C9@chatbase.com>
<SNIP monster SPAM post>
Wow, I'm impressed so far. Please send me lots of money now.
Send $1.00 to "Happy Dude" 1700 Evergreen Terrace.
--
Regards,
Tim Greer: chatmaster@chatbase.com / software@linkworm.com
The Chat Base: http://www.chatbase.com | 250,000+ hits daily Worldwide!
TRG Software & The Link Worm: http://www.linkworm.com
Custom chat server scripts, CGI scripting in Perl/C, Trouble shooting,
Security, Modify & Debug, Freelance Scripting and more!
------------------------------
Date: Sun, 16 May 1999 16:17:51 -0800
From: bsharvyNOSPAM@efn.org
Subject: MacPerl
Message-Id: <bsharvyNOSPAM-1605991617510001@dynip132.efn.org>
I recently downloaded MacPerl 5.2. I can't quite figure out what you can,
and cannot do with it. Could you, in theory, build applications like
Clarisworks or Quake with it? Is it just for CGI work? If you can make
full featured mac applictions with it, is there a book telling how?
------------------------------
Date: Mon, 17 May 1999 00:04:53 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Microsoft IIS4
Message-Id: <7hnl7t$o7i$3@holly.prod.itd.earthlink.net>
[ mailed & posted if address not munged ]
"Lone Wolf" <lone.wolf@net.ntl.com> wrote:
>if you took your head out of your arse and helped then maybe my next
>question, which I would have posted and probably wont now that I have been
>flamed on my first post,
You weren't flamed, you were given very good advice. But if you can't
tell the difference. Even the FAQs won't help.
* plonk *
------------------------------
Date: Sun, 16 May 1999 17:42:48 -0700
From: TRG Software : Tim Greer <webmaster@chatbase.com>
Subject: Re: Modify this Penpal script for better use
Message-Id: <373F6608.16F01300@chatbase.com>
"Yeong Mo/Director Hana co." wrote:
>
> Hi,
>
> I got a penpal script from a book, and it needs to be modofied a lot.
> It will be appreciated if you modify it for better use, and send me back.
Are you high?? Why did you post this here? Am I going completely nuts,
or does there seem to be a HUGE increase of NON-Perl related questions
lately?
--
Regards,
Tim Greer: chatmaster@chatbase.com / software@linkworm.com
The Chat Base: http://www.chatbase.com | 250,000+ hits daily Worldwide!
TRG Software & The Link Worm: http://www.linkworm.com
Custom chat server scripts, CGI scripting in Perl/C, Trouble shooting,
Security, Modify & Debug, Freelance Scripting and more!
------------------------------
Date: Sun, 16 May 1999 14:26:26 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Modules???
Message-Id: <ik2nh7.ae6.ln@magna.metronet.com>
ay-soterr (ay-soterr@geocities.com) wrote:
: Just a quick question..
: what does this mean?
Look it up yourself in perldiag.pod, where all of the messages
that perl might issue are explained.
It tells you how to fix the problem.
: utilities.pm did not return a true value at functions.pm line 3
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 16 May 1999 16:02:02 -0700
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: MS-HTML must die!
Message-Id: <373F4E6A.B022EA3F@mail.cor.epa.gov>
Ran wrote:
>
> In <7hdff7$kfi@dfw-ixnews9.ix.netcom.com>, jhertzli@ix.netcom.com (Joseph Hertzlinger) writes:
>
> >Microsoft apparently designs browsers
> >that can be used with sites designed by the clueless.
>
> Considering that that's their primary market, they pretty much have to.
That's why the clue-impaired love the OS and the apps.
And why large numbers of programmers hate both.
Hmm, this suggests a simple partition function...
Oh no! I'm writing this on a win98 box! Oh myG@d!
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Mon, 17 May 1999 00:08:41 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Off-topic: France (was Re: Perl "constructors")
Message-Id: <7hnlf2$o7i$4@holly.prod.itd.earthlink.net>
[ courtesy cc sent by mail if address not munged ]
Ala Qumsieh <aqumsieh@matrox.com> wrote:
>
>Scratchie <upsetter@ziplink.net> writes:
>
>> I once went to France with an (American) friend who couldn't understand
>> why supermarkets sold bread in plastic bags that had little holes in them.
>> "It would stay fresh a lot longer if they'd use a regular bag", he
>> lamented.
>
>I hope I am not being stupid here, but why do the bags have little
>holes in them?
So that the little french kids don't suffocate if they put the bags over
their heads.
------------------------------
Date: Sun, 16 May 1999 22:48:31 GMT
From: armchair@my-dejanews.com
Subject: Re: open, read,then print a file
Message-Id: <7hnhvv$buo$1@nnrp1.deja.com>
In article <m34slc24l6.fsf@moiraine.dimensional.com>,
Daniel Grisinger <dgris@moiraine.dimensional.com> wrote:
> armchair@my-dejanews.com writes:
>
> > In article <7hj78o$atj$2@justice.csc.cuhk.edu.hk>,
> > austin95002887@yahoo.com (Austin Ming) wrote:
> > >
> > > How to open, read,then print a text.txt file to the browser in
current
> > > dierectory ?
> > >
> > >
> <snip code that doesn't solve the requested problem>
>
> I don't think so. What you posted doesn't satisfy the
> request at all. If you are going to waste your time
> handing out code to people who don't read the docs the
> least you can do is give them the right code. Keeps
> them from coming back and bothering us with dumb question
> in the future.
Nothing could be more of a waste of time than somebody who deletes a
small amount of code, and then says it doesn't satisfy the request "at
all", after someone already pointed out that it only lacked one
statement to print the intitial line that the Web server looks for in a
CGI document. If you don't want to hear Perl questions, you should not
fire up your newsreader and read posts. And if you think some questions
are beneath you, then get a comp.lang.perl.beginner group going.
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: Sun, 16 May 1999 17:39:13 -0700
From: TRG Software : Tim Greer <webmaster@chatbase.com>
Subject: Re: opportunity in Boston-based internet start-up
Message-Id: <373F6531.FD6204F2@chatbase.com>
Jerome Catalino wrote:
>
> We are an internet start-up in Boston in need of a web savvy programmer.
If you're going to SPAM a perl NG, at least make mention of Perl.
--
Regards,
Tim Greer: chatmaster@chatbase.com / software@linkworm.com
The Chat Base: http://www.chatbase.com | 250,000+ hits daily Worldwide!
TRG Software & The Link Worm: http://www.linkworm.com
Custom chat server scripts, CGI scripting in Perl/C, Trouble shooting,
Security, Modify & Debug, Freelance Scripting and more!
------------------------------
Date: Sun, 16 May 1999 23:09:27 GMT
From: armchair@my-dejanews.com
Subject: Re: Perl "constructors"
Message-Id: <7hnj76$cnc$1@nnrp1.deja.com>
In article <slrn7jud9q.3ab.sholden@pgrad.cs.usyd.edu.au>,
sholden@cs.usyd.edu.au wrote:
> On Sun, 16 May 1999 19:28:53 GMT, armchair@my-dejanews.com wrote:
> >In article <slrn7jte10.fth.sholden@pgrad.cs.usyd.edu.au>,
>
>
> >From my limited experience looking for jobs, it appears that in
> >order to get hired for most of the them, one has to say that they
know
> >how to program in the language/use the tools that a company is using
> >(and it has to appear on the resume just to get past HR departments).
> >This doesn't have to be the actual case, as they rarely even come
close
> >to a thorough testing of your ability and knowledge in the interview
> >process, but you do need to know enough to get by the interview and
> >handle the first days on the job till you say "Gee, from all those
hours
> >on that last Fortran project I was on, I seem to have forgotten most
of
> >the Perl used to know so well. Can you remind me again what all those
> >dollar signs mean?". (Hence the Teach Yourself X in 14 hours/21 days
> >books) But they don't actually want knowledge or training, it is
> >supposed to be on the job experience. Hence people's references (aka
> >friends) have to say "Why yes he was is one of the best of us, I
mean
> >my best, Cobol, er, make that Java programmers that we have here in
our,
> >I mean my shop floor processing group, oops, not enough coffee I
> >suppose, we are actually the Web based on-line sales catalog and
> >shopping cart software group."
>
> Other people are honest.
Show me the other peoples resumes, and I will show you some dishonesty.
>
> >
> >Regarding your ASP job, unless it is some kind of a lateral transfer
or
> >hiring by people familiar to you, I haven't heard people getting jobs
by
> >walking up and saying "Don't know ASP, but I am a very competent
> >programmer and willing to learn". There would have to be an
ASP/Sybase
> >thing and they hired the person for great Sybase knowledge.
>
> No hired due to web programming experience. Taught myself ASP in a
couple
> of days (it was just ike VB after all). Found it aweful. Left job.
So you got hired for the reason I stated, you didn't have knowledge of
ASP, but other related knowledge the was directly applicable. Sybase was
just an example of a separate skill that a company could look for other
than ASP.
>
> >
> >And people are different. I would never find a language that I
couldn't
> >criticize or make suggestions for enhancements to, nor would my
comments
> >be the sign of hatred or duress as you try to suggest. Not every one
can
> >fall in love with a language - but not everyone needs to in order to
> >use it.
>
> I did say that you know (the different thing). Your comments might not
> be a sign of hatred or duress, but complaining over and
> over again that
> you don't like some basic key features of a language indicates to me
> you might prefer something else. You have choosen work over
> joy. That's fine. I do that all the time as well.
But I haven't been complaining over and over again. That's just your
spin, which is a poor attempt at censoring even the mildest commentary
that is not abject adoration for a programming language that you have
apparently deified.
>
> --
> Sam
>
> I promoted Holden to the head of my entire Asian operation,
> but he said that he found one our guest cottages in Singapore
> very noisy each Friday during trash collection. So he quit,
> saying if he can't love a job he's not going to do it.
> I understand he's his moved around a bit in the last two years.
> --Rupert Murdoch
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: Mon, 17 May 1999 00:21:40 GMT
From: pacman@defiant.cqc.com (Alan Curry)
Subject: Re: Perl "constructors"
Message-Id: <oiJ%2.7880$LP2.159246@news6.ispnews.com>
In article <yld8011he1.fsf@windlord.stanford.edu>,
Russ Allbery <rra@stanford.edu> wrote:
>Alan Curry <pacman@defiant.cqc.com> writes:
>
>> If it is really that difficult to support a choice of memory allocation
>> policies (which I doubt), then why must the _unsafe_ policy be the
>> Chosen One? Why not have perl always sleep-and-retry after a brk failure
>> at any level?
>
>Um, you'll find that the *vast* majority of all programs immediately exit
>on a memory allocation failure. Probably 99% of them. That's usually
>what you want to do. Long running processes that should keep running in
>the face of any failure condition are the *very uncommon* case.
Would you use perl if it died every time a fork() failed with EAGAIN?
Would you use perl if it died every time a bind() failed with EADDRINUSE?
Would you use perl if it died every time an open() failed with ENFILE?
Why then do you tolerate a language that dies whenever a brk() fails with
ENOMEM? These are all _temporary_ failures, and the programmer should have
the freedom to deal with them as he wishes. Where do you draw the line that
makes it acceptable for a general-purpose interpreter to turn a temporary
error into a fatal one?
Other parts of this thread claim that perl doesn't force any particular
programming style. Die-on-brk-failure is a style, and one that I don't like,
which is forced upon every perl program. Can you smell the hypocrisy?
--
Alan Curry |Declaration of | _../\. ./\.._ ____. ____.
pacman@cqc.com|bigotries (should| [ | | ] / _> / _>
--------------+save some time): | \__/ \__/ \___: \___:
Linux,vim,trn,GPL,zsh,qmail,^H | "Screw you guys, I'm going home" -- Cartman
------------------------------
Date: 17 May 1999 01:19:27 GMT
From: mist@yoyo.cc.monash.edu.au (Michael Stillwell)
Subject: Re: Perl "constructors"
Message-Id: <slrn7jurku.i7p.mist@fangorn.cs.monash.edu.au>
On 14 May 1999 21:40:26 -0700, Tom Christiansen <tchrist@mox.perl.com> wrote:
: [courtesy cc of this posting sent to cited author via email]
:
: In comp.lang.perl.misc, armchair@my-dejanews.com writes:
:
: :But there is the lack of a record construct in
: :Perl.
:
: You're confused. The %hash is Perl's record construct.
According to my benchmarks, you take about a 20% performance hit doing
records with a hash though. I guess you can improve things with
#defines:
package Point;
#define X 0
#define Y 1
sub new {
my ($class, $x, $y) = @_;
my $self = [ ];
$self->[X] = $x;
$self->[Y] = $y;
bless $self, $class;
}
But I haven't seen any code that does this. Is this because it makes
inheritance hard?
Michael
--
.. ABSOLUT .SIG. ..
.. Michael Stillwell ..
.. mist@yoyo.cc.monash.edu.au ..
.. http://yoyo.cc.monash.edu.au/~mist/ ..
------------------------------
Date: Sun, 16 May 1999 17:54:21 -0700
From: TRG Software : Tim Greer <webmaster@chatbase.com>
Subject: Re: perltootc - OO Tutorial for Class Data in Perl
Message-Id: <373F68BD.368984B@chatbase.com>
Tom Christiansen wrote:
>
> I've gotten some feedback that this posting was too large to be easily
> digested in a quick read, and that perhaps it should have been posted in
> smaller segments, such as each piece in the outline above. Would that
> really have helped people read and understand these? Wouldn't it have
> seemed more like spam than like an ten-part mini-series? :-)
>
> --tom
> --
> "Did you know, 50% of doctors graduated at the BOTTOM HALF of their class."
Why would someone complain about getting *all* the information in one
post? I didn't mind. (I guess that's my opinion).
--
Regards,
Tim Greer: chatmaster@chatbase.com / software@linkworm.com
The Chat Base: http://www.chatbase.com | 250,000+ hits daily Worldwide!
TRG Software & The Link Worm: http://www.linkworm.com
Custom chat server scripts, CGI scripting in Perl/C, Trouble shooting,
Security, Modify & Debug, Freelance Scripting and more!
------------------------------
Date: Sun, 16 May 1999 23:28:34 GMT
From: design@raincloud-studios.com (Charles R. Thompson)
Subject: Re: Sorting of array of hashes.
Message-Id: <MPG.11a920059c710d9d9896cf@news>
In article <7hne02$em8$1@xenon.inbe.net>, Michel Dalle says...
> In article <MPG.11a8eed9283edc1d9896cd@news>, design@raincloud-studios.com (Charles R. Thompson) wrote:
> Would the following be too 'simple' ?
Simple.. complex.. I don't care either way... as long as I learn how. :)
This works... of course it went right by me, but I'll look at it real
close because I must be missing the obvious. :) Thanks so much.
I'm surprised out of all the complex data structure examples on
mox.perl.com and in the published cookbook that Tom chose to not show
sorting in this manner. What you have shown me looks alot like the
sorting hashes in a hash example, so I can kinda see how it applies. I
just need to re-read chapter 4 again.
The only drawback is having to add a 'manual' counter to display page
numbers in the loop. With the Foreach loop in your example, it returns
the position of the sorted page in the original array. So number wise,
things are out of whack. No biggie though. There's no way you could have
known that without a code example.
> foreach $page (sort by_title 0..$#pages) {
> &printpage($page);
> }
I haven't figured this out yet, but for some reason I keep ending up with
a blank record at element 0 in my array. It's been there from the
start. Starting the loop at 1 fixes it, but I still haven't tracked down
where the 'ghost record' comes in.
> Same thing for the other keys. I'm not sure exactly what structure you're
> using, though.
You got it right on the dot. Thanks alot. Helped me out tremendously.
--
CT
------------------------------
Date: Sun, 16 May 1999 18:15:58 -0500
From: David Lent <dlent1@uic.edu>
Subject: Strange file reading problem
Message-Id: <Pine.GSO.4.10.9905161810320.4076-100000@icarus.cc.uic.edu>
Here's the code I'm having problems with:
unless(open(NEWFILE, "$adVar.ad")) {
die("$file could not be opened for r");
}
print <NEWFILE>;
Here's the input file it reads:
David Lent~|U.S.A.~|dlent@eecs.uic.edu~|For Sale:~|6x30mm Meade
Finder~|6x30mm M
eade finder for sale. Optics are in excellent condition. The tube has
scratche
s and this finder DOES NOT INCLUDE MOUNTING RINGS. In other words it's
just the
tube.
Price: $15.00 + $5.00 for regular UPS shipping to the continental 48
states.~|~|
tin~|~|
Here's the output:
Price: $15.00 + $5.00 for regular UPS shipping to the continental 48
states.~|~|tin~|
Why is it only reading the second half of the file? Does it have a
problem with blank spaces? Yes, I've read the perldoc for open.
------------------------------
Date: 16 May 1999 20:52:55 -0400
From: Jonathan Feinberg <jdf@pobox.com>
To: David Lent <dlent1@uic.edu>
Subject: Re: Strange file reading problem
Message-Id: <m3lneott3s.fsf@joshua.panix.com>
David Lent <dlent1@uic.edu> writes:
> unless(open(NEWFILE, "$adVar.ad")) {
> die("$file could not be opened for r");
> }
This is a bit awkward. The idiom is
open(NEWFILE, "$adVar.ad")
|| die "Can't open $adVar.ad for read: $!\n";
Notice that your code refers to the mystery variable $file in the
error output. Notice, also, that your error message does not include
the $! variable, so you'll never know *why* the open failed.
> print <NEWFILE>;
> Why is it only reading the second half of the file? Does it have a
> problem with blank spaces? Yes, I've read the perldoc for open.
I don't believe that the code you've shown us is exactly what's in
your script! The code, as written, will indeed print the contents of
the whole file. What switches are on the shebang line? Did you
remember to use -w?
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Sun, 16 May 1999 21:13:42 -0700
From: "Jim Bell" <jbell@263.net>
Subject: use array as keys in a hash
Message-Id: <c3K%2.961$u3.355929088@momma.bigmomma.com>
Hi, all
# I have an array like this
my @arr = ( a,b,c );
# then I have a hash like this
my %ha = (
'a' => '1',
'b' => '2',
'c' => '3' )
# so now, can I do something like this in order to print all %ha?
print $ha{@a};
# I know this one doesn't work, but is there something similar
# which can do the job with a line?
thanks
--
_____
Regards,
Jim Bell
------------------------------
Date: 17 May 1999 01:18:41 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: use array as keys in a hash
Message-Id: <slrn7jurjh.9s9.sholden@pgrad.cs.usyd.edu.au>
On Sun, 16 May 1999 21:13:42 -0700, Jim Bell <jbell@263.net> wrote:
># I have an array like this
>my @arr = ( a,b,c );
># then I have a hash like this
>my %ha = (
> 'a' => '1',
> 'b' => '2',
> 'c' => '3' )
># so now, can I do something like this in order to print all %ha?
>print $ha{@a};
print @ha{@arr};
If you want an array ask for an array... ;)
--
Sam
Perl was designed to be a mess (though in the nicest of possible ways).
--Larry Wall
------------------------------
Date: 17 May 1999 00:28:01 GMT
From: anonymous@nouce.net (anonymous)
Subject: Wanted a email script for message board
Message-Id: <7hnnqh$2h7$1@owl.slip.net>
Hello,
While surfing the web I say a script at http://www.globaldialog.com/mickalo/post.html
that I was wondering if someone has one or know where I can get one that I can use.
The script basically is a email script that if a person places a x in the box his/her email address
will appear on the message board and if he/she doesn't then it won't show.
The script must be a written in perl.
Any help would be appreciated.
Ps: Email address is invalid due to large amount of spam
------------------------------
Date: Mon, 17 May 1999 01:11:24 GMT
From: Bill Huston <bhuston@eden.com>
Subject: Where to install DB_File (tied hash) in distributed module? +MakeMaker Q's
Message-Id: <01K%2.30464$ny.2016803@typhoon-sf.snfc21.pbi.net>
Hi all,
I want to distribute a module which will contain a DB_File tie'd hash.
It is static and will never change. I need to construct this during
the 'make' process, test it, then move it... somewhere.
Let's call my module Bozo::Clown, and let's say MakeMaker decides that
it should get installed into "/usr/lib/perl5/site_perl/Bozo/Clown.pm".
Q1: Where do I put the DB_FILE?
Until someone tells me otherwise, I'm gonna pretend that it's OK to put
it in same directory as where the module gets installed.
Q2: How do I build the DB_File'd hash during the install?
What I've come up with doesn't work.
Let's call the DB_File "clown_names.db". I have a script which creates
it called "create_clown_db.pl".
Here is my Makefile.PL: (I am not a "make" guru)
| WriteMakefile(
| NAME => 'Bozo::Clown',
| OBJECT => 'clown_names.db',
| NEEDS_LINKING => 0
| );
|
| sub MY::postamble {
| 'clown_names.db:
| $(PERL) create_clown_db.pl
| mv *.db $(INST_LIB)';
| }
When I actually do the make, something gets confused into thinking I've
got compiled code:
> AutoSplitting Bozo::Clown(./blib/lib/auto/Bozo/Clown)
> make: *** No rule to make target `blib/arch/auto/Bozo/Clown/Clown.so', needed
> by `dynamic'. Stop.
Huh? Me gots no .so!
Q3: Assuming I can get my .db file built, what is the best way to ensure that
it will get installed along with my .pm file? Is moving it to $(INST_LIB)
good enough?
Thanks,
Bill
--
Bill Huston bhuston@eden.com http://mu.clarityconnect.net
"Drug-Free School Zone? Big LIE! Just an excuse to bust hippies
down the street. If they were committed to the concept, they'd
ban Ritalin and Pepsi!" -- Will Freedom!, from _Live in Dunellen_
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 5690
**************************************