[9258] in Perl-Users-Digest
Perl-Users Digest, Issue: 2853 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 12 09:07:54 1998
Date: Fri, 12 Jun 98 06:01:03 -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 Fri, 12 Jun 1998 Volume: 8 Number: 2853
Today's topics:
Re: [META] hypersensitivity <rra@stanford.edu>
Re: Certified Perl Programmers (Mike Whitaker)
Re: CFV: comp.lang.perl.moderated moderated (Chris Nandor)
Child processes on Win32 perl ianwills@my-dejanews.com
Re: Document contains no data? (Mike Whitaker)
gethostbyaddr <6518176x@mmu.ac.uk.tosspot>
Re: gethostbyaddr <tchrist@mox.perl.com>
Handling of the ASCII behavior of ^M <demaille@inf.enst.fr>
Re: Have we got a good free Perl manual? <dak@mailhost.neuroinformatik.ruhr-uni-bochum.de>
Re: Have we got a good free Perl manual? <matt@pcr7.pcr.com>
Re: Have we got a good free Perl manual? <tchrist@mox.perl.com>
Re: Help with Perl CGI script (Craig Pickles)
Re: hmmm, suggestions? (Michael J Gebis)
Re: hmmm, suggestions? (Michael J Gebis)
Re: hmmm, suggestions? <tchrist@mox.perl.com>
Re: MODERATION: Time to Vote (Chris Nandor)
Most common element of array. (Michael J Gebis)
Re: Most common element of array. (Mike Whitaker)
Re: New module/pragma "enum.pm" (was "fields.pm") (Brendan O'Dea)
Perl & GDBM monica@qmaster.com
Re: Perl NT IIS4.0 - can't get Perl to work via the web <r.d.smith@man0501.wins.icl.co.uk>
Problem with MOMSpider <jasuther@dux.dundee.ac.uk>
Re: removing dups from a file (Michael J Gebis)
Re: reverse sorting <dformosa@st.nepean.uws.edu.au>
Re: Suche ein Perl Buch - Translation <quednauf@nortel.co.uk>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 12 Jun 1998 03:11:31 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: [META] hypersensitivity
Message-Id: <m3ium753qk.fsf@windlord.Stanford.EDU>
jimbo <jimbo@soundimages.co.uk> writes:
> Even more disheartening is that Mr. Bacon is a moderator should a
> moderated group become reality. I fear that Perl, if left to the likes
> of Mr. Bacon, will become (even more than today) a culture of us vs
> them. The **in the know and are'nt we just the greatest wizards of all
> time** vs **the rest of us who have heard and want to learn and use Perl
> but are considered sub human because we hold an OS license from
> Redmond**.
The proposed newsgroup has quite a few more moderators than just
Mr. Bacon, and people behave *much* differently when they're sharing their
opinion in a newsgroup along with everyone else and when they're in a
responsible position fulfilling the trust of a community.
--
#!/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: 12 Jun 1998 09:34:35 GMT
From: mrw@malay.entropic.co.uk (Mike Whitaker)
Subject: Re: Certified Perl Programmers
Message-Id: <slrn6o1tb2.gdb.mrw@malay.entropic.co.uk>
On 11 Jun 1998 12:47:36 -0600,
Nathan Torkington <gnat@frii.com> wrote:
>People's Glorious Revolutionary Tool.
Ahem.
That's People's Emancipated Revolutionary Language.
Thank you.
Wow - freedon, acronyms, religion and certification in one thread.
If that doesn't get tchrist's attention I shall have to start
asking where to find Dog $spot and the use fields stuff (*mutters at
DejaNews which seems unwilling to throw up references*).
B-) for the people taking life too seriously (except for the Dog $spot and
use fields stuff, which is a serious question).
--
Mike Whitaker: Sysadmin, Entropic Cambridge Research Labs
------------------------------
Date: Fri, 12 Jun 1998 12:10:28 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: CFV: comp.lang.perl.moderated moderated
Message-Id: <pudge-1206980807430001@dynamic174.ply.adelphia.net>
In article <6lpk1i$chn$1@en1.engelschall.com>, sb@engelschall.com (Steffen
Beyer) wrote:
# 1) All registered module authors (= the "who's who" list in The Perl 5 Module
# List) may vote the members of the moderation panel. They have 6 votes (for six
Don't forget about the landowners!
Seriously, this is completely unacceptable. I know people who have not
written modules who are just as important to the Perl community as most
module authors.
Further, no one wants to take the time to deal with votes. It is a pain
in the arse.
# 2) Leave the CFV as it is, in principle, just add the possibility that if
# at least, say, 20 Netizens request it, there should be a poll (CFV) wether
# a given member of the panel should be dismissed. This voting would roughly
# follow the same guidelines as above, with at least 40 more "yes" (= "dismiss")
# than "no" (= "leave on duty") votes, but anybody would be allowed to vote
# this time.
No one wants to take the time to deal with votes. It is a pain in the arse.
If you can cite precedent for such a thing, it might be reasonable to
investigate it.
--
Chris Nandor mailto:pudge@pobox.com http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6'])
------------------------------
Date: Fri, 12 Jun 1998 09:11:03 GMT
From: ianwills@my-dejanews.com
Subject: Child processes on Win32 perl
Message-Id: <6lqrb7$gdf$1@nnrp1.dejanews.com>
I need to run a process in the background and I need to be able to do the
following to the process
o Read the child processes STDOUT.
o Kill the process if I believe it is hanging.
Using the Win32::Process:Create I can create and Kill the process at will, but
how can I obtain its STDOUT ?
Alternatively, I can intercept the STDOUT by issuing the child process in
backticks, but then I can't kill the process, because it may not return.
Is there any way that I can achieve both objectives ?
Many Thanks for any help given.
Ian Wills
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 12 Jun 1998 09:39:57 GMT
From: mrw@malay.entropic.co.uk (Mike Whitaker)
Subject: Re: Document contains no data?
Message-Id: <slrn6o1tl4.gdb.mrw@malay.entropic.co.uk>
On Thu, 11 Jun 1998 15:05:16 -0500,
Gabriele R. Fariello <gabriele@kollwitz.doit.wisc.edu> wrote:
>by a script) will give you an 500 error (usually internal server error, at
>least on Apache and IIS). You shoul dbe able to look at the error_log file
>for run-time error output. It is usually found in /var/log/httpd/error_log
>or somewheres thereabout on UNIX systems.
use CGI::Carp qw(fatalsToBrowser); # is your friend
--
Mike Whitaker: Sysadmin, Entropic Cambridge Research Labs
------------------------------
Date: Fri, 12 Jun 1998 11:03:10 +0100
From: Edward Jung <6518176x@mmu.ac.uk.tosspot>
Subject: gethostbyaddr
Message-Id: <3580FCDD.5F06CCEF@mmu.ac.uk.tosspot>
Hi,
wondering if anyone can help me with the 'gethostbyaddr' function. My
line goes like
this :
$name = gethostbyname($hostadd,$addrtype);
Now the problem I'm having is what to put in the $addrtype parameter.
Any explainations of the field appreciated.
Edward
*****
'Everything is nothing if you've got noone'
* Islands In The Stream
* Mark Radcliffe | Visit my homepages at :
* BMX Bandits | http://tony.geog.aca.mmu.ac.uk/~junge/junge/
* Helen Love |
* Red Cat | Something Old, Something New, Always True.
*******************************
------------------------------
Date: 12 Jun 1998 12:10:48 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: gethostbyaddr
Message-Id: <6lr5s8$rgd$3@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Edward Jung <6518176x@mmu.ac.uk.tosspot> writes:
yeah sure
:wondering if anyone can help me with the 'gethostbyaddr' function. My
:line goes like
:this :
: $name = gethostbyname($hostadd,$addrtype);
:
:Now the problem I'm having is what to put in the $addrtype parameter.
Grep the Pods, Edward.
Where did you hear about some gethostbyaddr() function? From
perlfunc or perlipc, perchance? These answer your question.
perldelta4.pod: Net/hostent.pm By-name interface to Perl's builtin gethost*
perldiag.pod:=item gethostent not implemented
perldiag.pod:(F) Your C library apparently doesn't implement gethostent(), probably
perlfaq9.pod:(assuming you have working DNS) with a gethostbyname() call.
perlfaq9.pod: my $addr = inet_ntoa(scalar(gethostbyname($name)) || 'localhost');
perlfunc.pod:C<endprotoent>, C<endservent>, C<gethostbyaddr>, C<gethostbyname>,
perlfunc.pod:C<gethostent>, C<getnetbyaddr>, C<getnetbyname>, C<getnetent>,
perlfunc.pod: $herhostname = gethostbyaddr($iaddr, AF_INET);
perlfunc.pod:=item gethostbyname NAME
perlfunc.pod:=item gethostbyaddr ADDR,ADDRTYPE
perlfunc.pod:=item gethostent
perlfunc.pod: ($name,$aliases,$addrtype,$length,@addrs) = gethost*
perlfunc.pod:For the I<gethost*()> functions, if the C<h_errno> variable is supported in
perlipc.pod: my $name = gethostbyaddr($iaddr,AF_INET);
perlipc.pod: my $name = gethostbyaddr($iaddr,AF_INET);
perlipc.pod: my $iaddr = gethostbyname('localhost');
perlipc.pod: use Net::hostent; # for OO version of gethostbyaddr
perlipc.pod: $hostinfo = gethostbyaddr($client->peeraddr);
perlipc.pod: $iaddr = gethostbyname(hostname());
perlipc.pod: $host = gethostbyaddr($hisiaddr, AF_INET);
perlmodlib.pod:by-name interface to Perl's builtin gethost*() functions
perltoc.pod:WHICH,WHO, getpwnam NAME, getgrnam NAME, gethostbyname NAME, getnetbyname
perltoc.pod:NAME,PROTO, gethostbyaddr ADDR,ADDRTYPE, getnetbyaddr ADDR,ADDRTYPE,
perltoc.pod:gethostent, getnetent, getprotoent, getservent, setpwent, setgrent,
perltoc.pod:=head2 Net::hostent - by-name interface to Perl's built-in gethost*()
perltoot.pod:wanted to override Perl's idea of gethostbyname() and gethostbyaddr() so
perltoot.pod: $h = gethostbyname("perl.com"); # object return
perltoot.pod: @EXPORT = qw(gethostbyname gethostbyaddr gethost);
perltoot.pod: sub gethostbyname ($) { populate(CORE::gethostbyname(shift)) }
perltoot.pod: sub gethostbyaddr ($;$) {
perltoot.pod: populate(CORE::gethostbyaddr($addr, $addrtype))
perltoot.pod: sub gethost($) {
perltoot.pod: &gethostbyaddr(Socket::inet_aton(shift));
perltoot.pod: &gethostbyname;
perlvar.pod:is returned via $? if any of the C<gethost*()> functions fail.
--tom
--
"I discount everything Djikstra has to say because he doesn't actually
run his programs" --Rob Pike, On Djikstra's belief that bugs in your
program are a moral failure to prove your program mathematically correct.
------------------------------
Date: 12 Jun 1998 12:02:01 +0200
From: Akim Demaille <demaille@inf.enst.fr>
Subject: Handling of the ASCII behavior of ^M
Message-Id: <qylium79bvq.fsf@ubu.enst.fr>
--Multipart_Fri_Jun_12_12:02:01_1998-1
Content-Type: text/plain; charset=US-ASCII
Hi!
I wanted to write a small snippet that handles ^M as it should be in
ASCII, i.e., goes back to the beginning of the line, and superimpose
the next line on it.
I fell down to this:
#! /usr/local/bin/perl -w
while (<>)
{
chop;
@lines = ("")
unless (@lines = split ("\r"));
while ($#lines)
{
$added = pop (@lines);
$lines[0] .= " " x (length ($added) - length ($lines[0]));
for (my $cur = 0 ; $cur <= length ($added) ; $cur += 1)
{
substr ($lines[0], $cur, 1) = substr ($added, $cur, 1)
if (substr ($added, $cur, 1) ne ' ');
}
}
print "$lines[0]\n";
}
Has somebody got a better idea?
Here is a test case (it is zipped not because it's big, but because I
fear that my mailer breaks it):
--Multipart_Fri_Jun_12_12:02:01_1998-1
Content-Type: application/octet-stream; type=gzip
Content-Disposition: attachment; filename="clex7.page8.lst.gz"
Content-Transfer-Encoding: base64
H4sICE29fjUCA2NsZXg3LnBhZ2U4LmxzdACtVF1rwjAUfS/rf7hvwrQl7YzVvYWabYUOg+k2
Xyd2ICgd6h4Ef/zix2gak5pO70PhcnNOTk7vvXdQE3FKOAc6Ia8spRDVHe27jrlI4uyNpPDO
fWBjOkzijA7rzlcjCB5RD55W89nntgM8/97ky2m+giDsQDAYRK5zxsUWxQaKLxiTLBndf9Dk
+SXzAfh2OS0W8LPOZzBfQ4u0fCOUlbB9qFC2hx7Bh0tgd2JCfoShLdPuzImwRsn/HCvZkGCr
KrQk1yXI72GV7za0yPrRegJ85trFxmB676qt15BTtQHsEeINwgTjDFi3hA3eeMh2qErRXWwW
3Ui5/r920QX6xtJPD2DNPZSvO3wIuYrkX8IV+x9M83j7Rr165oVaZcw9z2t7Utgn1cUrJkda
+EjKArkUypUQI83q18ZxlbvOL+Ryn7XuBgAA
--Multipart_Fri_Jun_12_12:02:01_1998-1
Content-Type: text/plain; charset=US-ASCII
Akim
--
P-mail: Akim Demaille, 107 rue Bobillot, F-75013 Paris, France
E-mail: demaille@inf.enst.fr
V-mail: +33 1 45 81 78 68
--Multipart_Fri_Jun_12_12:02:01_1998-1--
------------------------------
Date: 12 Jun 1998 12:57:15 +0200
From: David Kastrup <dak@mailhost.neuroinformatik.ruhr-uni-bochum.de>
Subject: Re: Have we got a good free Perl manual?
Message-Id: <m2emwuq450.fsf@mailhost.neuroinformatik.ruhr-uni-bochum.de>
lehman@visi.com (Todd Lehman) writes:
> rms@gnu.org (Richard Stallman) writes:
> > Once upon a time, I thought I would learn Perl. I got a copy of a
> > free manual, but I found it simply unreadable, and gave up. Perl
> > users told me that there were better manuals, but they were not free.
>
> It seems odd to deny oneself the pleasure of learning a new language for
> several years simply because someone tells you that the best documentation
> isn't freely available.
If you are learning the language for pleasure, you might want to
acquire non-free books. If you want to learn the language in order to
use it for programming free software, the non-existence of good free
documentation will block a lot of possible contributors from helping.
That's not what free software is about. Do you have an idea how
expensive a "cheap" American book comes, for example, to an average
former Soviet programmer?
>
> > Why was this? Their authors had sold the manuals to O'Reilly, instead
> > of contributing them to the free software community.
>
> But it was their choice.
>
>
> > It wasn't the
> > first time and (to our community's great loss) it was far from the
> > last.
>
> It was their choice. To suggest that it was a loss to the community is
> to say that they were under some cosmic obligation to contribute free
> documentation for the free software they created.
This is nonsense. It is a loss to the community period. If they were
under some cosmic obligation, the community would not encounter any
loss because it could sue them for providing the stuff. As they are
not under an obligation, it is a loss to the community for good.
For that reason, RMS has put good free books about Perl on the task
list. He has not put any demands on anybody to take this up. He has
been flamed beyond sanity and called all sorts of names like "liar",
"hypocrite", "evil", "Bill Gates of free software" and whatever,
however, for *daring* to put something like that on the task list.
>
> > Perl is an important piece of free software, and it ought to have a
> > *good* free manual.
>
> I share the same *opinion*, but where does "ought to" come from? Says who?
> Someone ought to sit down and spend gobs of their own spare time writing a
> good free manual because someone unwilling to buy a non-free manual said so?
> (Titles aside, that's what it comes down to, doesn't it?)
Yes. That's how free software usually happens. That's why it is in
the task list. Quite accurately observed.
> You should face the simple fact that you failed to motivate someone out
> there to write what you wanted them to write.
>
> But there is nothing wrong with that. You just need to try again -- perhaps
> from a different angle -- or perhaps delegate the broader task -- enlist
> someone who can drum up the enthusiasm and provide the needed
> motivation.
That's why it is in the task list. Which is why he was flamed beyond
belief.
> > What they can't be is part of the free software
> > community.
>
> I would argue that the O'Reilly Perl books and TPJ are in fact very much a
> part of the free software community (w.r.t. Perl) as they document a piece
> of free software.
They are not part of the free software community because nothing free
ever comes back from them. Documentation by them is as much part of
the free software community as dandruff is part of my body: initially
very close, it nevertheless does not contribute anything to any living
cells of me and will eventually in its unchanged state fall off. It
is associated to free software, but is not part of the community.
> Does not the free software community extend far beyond
> the simple set of things which are free?
Nope. Free software community is the people working on free
software. A bar is not part of the mining industry even when it keeps
alive by being visited by miners.
--
David Kastrup Phone: +49-234-700-5570
Email: dak@neuroinformatik.ruhr-uni-bochum.de Fax: +49-234-709-4209
Institut f|r Neuroinformatik, Universitdtsstr. 150, 44780 Bochum, Germany
------------------------------
Date: 12 Jun 1998 12:01:58 GMT
From: "Matt Heusser" <matt@pcr7.pcr.com>
Subject: Re: Have we got a good free Perl manual?
Message-Id: <01bd95f1$ad655c40$47eb1bcc@XSTA71.pcr.com>
Y'know, we have this guy in our office - the
brilliant/esoteric type. (Y'know - he doesn't
shave much, looks like he sleeps in his
clothes, but MAN the guy is SMART.)
Anyway, the way he converted me to Perl
was by getting all his work done in the morning
in about an hour, and then playing Quake all day.
(While I'm writing in C, 45 hours a week.)
So, I ask him how he writes code so fast, and
he says "Perl." So, I ask him how he learned it,
and he says "I just read the man pages and the
perlDoc, compiled it on my own, and looked at
usenet for examples."
About two weeks later, the boss asks me to
take over a project that this other programmer had
been doing - and the source is in Perl, so I have to
learn it. What did I do? I GOT THE BOSS TO
BUY ME A PERL BOOK. Problem solved.
The moral? (1) If you spend enough time at
it, you really can learn perl by reading the man
pages, (2) if you don't want to do that, get the
boss to buy you a book, (3) There is no ultra-easy
way to learn perl. Sorry, but you'll have to sit down
and write code, and (4) No one in this world has
an obligation to make your life easier. Go read
"Atlas Shrugged" by Anne Rand. Then, just for
a sense of balance, read the Gospel according
to John, Acts, and Romans. In neither book
will you hear the word "Welfare" as you are trying
to apply it to software.
... and by that time, you could have just read
the Man pages. ;-)
regards,
Matt H.
------------------------------
Date: 12 Jun 1998 12:04:38 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Have we got a good free Perl manual?
Message-Id: <6lr5gm$rgd$2@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
David Kastrup <dak@mailhost.neuroinformatik.ruhr-uni-bochum.de> writes:
:They are not part of the free software community because nothing free
:ever comes back from them.
Actually, this is incorrect. You haven't been reading between the lines,
but that's as it was meant to be.
--tom
--
It is Unix. It is possible to overcome any number of these bogus features. --pjw
------------------------------
Date: Fri, 12 Jun 1998 12:28:39 GMT
From: pickles_c@hotmail.com (Craig Pickles)
Subject: Re: Help with Perl CGI script
Message-Id: <358101f2.75817216@news.demon.co.uk>
>Guess I should be a little more specific. LOL. I have no problem making
>my script send mail using the good old-fashioned To: and From: headers.
>What I *do* have a problem with is writing a program that can utilize
>the Cc: and Bcc: headers as well.
Are you asking this because you seriously need to send the email to
people using CC or BCC, or is it that you want to send the same email
to MULTIPLE addresses? If you really do need to send using the CC
etc... then I dont know how to do it, but there is nothing stopping
you putting a number of email address in the to line seprated by
commas......
email1@emailadd.com , email2@emailadd.com , email3@etc.com
If this isnt what you ultimately want to achieve, then apologies for
wasting your time, but it may help....?
Craig
------------------------------
Date: 12 Jun 1998 05:57:54 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: hmmm, suggestions?
Message-Id: <6lqg12$7he@mozo.cc.purdue.edu>
"Lord Byron" <lordbyron@rapidnet.net.au> writes:
}Hi. I realise this is probably an annoying message, but I'm (trying) to
}learn Perl, and I was wondering if any of you knew of a good way to
}accelerate things? Are there any particularly good tutorials or books that
}would help things out?
1) The perl FAQ. My favorite copy resides on www.perl.com in html
format (it's not hard to find, and there is lots of nifty stuff on
that site, so poke around.) You almost certainly got a local copy
when you installed perl, which may or may not be more convienient to
use. Technicaly, I should chastize you for not reading the FAQ first,
since it addresses this very question, but that's sort of a catch-22.
You better check there first next time, or I'll give you the dreaded
evil eye. ;)
2) Learning Perl, by Randal Schwartz. You'll learn about this when
you read the FAQ, but it deserves a shout-out. It's good book.
Good luck.
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: 12 Jun 1998 06:11:54 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: hmmm, suggestions?
Message-Id: <6lqgra$7jd@mozo.cc.purdue.edu>
gebis@albrecht.ecn.purdue.edu (Michael J Gebis) writes:
}2) Learning Perl, by Randal Schwartz. You'll learn about this when
}you read the FAQ, but it deserves a shout-out. It's good book.
Lord knows I'm gonna get reamed for even making this mistake in the
first place, but the proper information is:
By Randal L. Schwartz & Tom Christiansen Foreword by Larry Wall
2nd Edition July 1997
1-56592-284-0, Order Number: 2840
302 pages, $29.95
http://www.oreilly.com/catalog/lperl2/
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: 12 Jun 1998 12:01:02 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: hmmm, suggestions?
Message-Id: <6lr59u$rgd$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
"Lord Byron" <lordbyron@rapidnet.net.au> writes:
:Hi. I realise this is probably an annoying message, but I'm (trying) to
:learn Perl, and I was wondering if any of you knew of a good way to
:accelerate things? Are there any particularly good tutorials or books that
:would help things out?
You mean like section 3 of the perlfaq? Or maybe even the tiny
bits on efficiecy tucked away in chapter 8 of the Camel?
--tom
--
"You're flame-proof in the same sense that certain plastics are fluorine-proof."
--Larry Wall
------------------------------
Date: Fri, 12 Jun 1998 12:12:51 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: MODERATION: Time to Vote
Message-Id: <pudge-1206980810060001@dynamic174.ply.adelphia.net>
In article <6lq3hs$cmn@nntp02.primenet.com>, "Gary L. Burnore"
<gburnore@primenet.com> wrote:
# Translation. Stanley is pointing out a truth that Tom can't handle.
# Some of the moderators can't be trusted. THe vote should be no till that
# changes.
You are so cool, I don't know where to begin.
--
Chris Nandor mailto:pudge@pobox.com http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6'])
------------------------------
Date: 12 Jun 1998 02:53:50 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Most common element of array.
Message-Id: <6lq57u$673@mozo.cc.purdue.edu>
(Note: Flames via e-mail only, please.)
This is intended as a fun and educational excursion into the world of
efficiency; I ran across this problem and have a satisfactory
solution, but thought the problem in general might be of some
interest.
I have an array:
#pragma DWIM
@array=('duck','duck','duck','duck','goose','duck','goose');
I'd like to find the most common element in the array:
print most_common(@array); #prints "duck"
Okay, if you're in the right spirit, and want to try to craft a
solution unbiased by my own, now's your chance.
First of all, clever readers may have already noticed that the problem
statement is a bit unclear in certain cases, like when there is a tie,
or every element is unique. To tell the truth, I'm not sure what the
right answer is in those cases--feel free to make suggestions. This
was not a case I was worried about in my particular problem.
What I did was create a hash mapping values->number of occurences. I
can then find the key with the maximum value in that hash, and there
you go.
However, my code is ugly--too ugly to post, in fact. This feels
like something that could be a one-liner. I also realized that I'm
probably finding the maximum value in a sub-optimal way. (Okay, I
_know_ it's run-time inefficient to use sort, but I'm actually looking
for a high niftiness factor :)
Alright, there you have it, and I appreciate any constructive comments
of elegant solutions. Thanks!
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: 12 Jun 1998 12:33:37 GMT
From: mrw@malay.entropic.co.uk (Mike Whitaker)
Subject: Re: Most common element of array.
Message-Id: <slrn6o27qo.ge5.mrw@malay.entropic.co.uk>
On 12 Jun 1998 02:53:50 GMT,
Michael J Gebis <gebis@albrecht.ecn.purdue.edu> wrote:
>(Note: Flames via e-mail only, please.)
>
>This is intended as a fun and educational excursion into the world of
>efficiency; I ran across this problem and have a satisfactory
>solution, but thought the problem in general might be of some
>interest.
>
>I have an array:
>#pragma DWIM
>@array=('duck','duck','duck','duck','goose','duck','goose');
>
>I'd like to find the most common element in the array:
>
>print most_common(@array); #prints "duck"
>
>Okay, if you're in the right spirit, and want to try to craft a
>solution unbiased by my own, now's your chance.
#!/usr/bin/perl -w
use strict;
use diagnostics;
sub most_common {
my %count;
foreach (@_) { $count{$_}++; }
(sort { $count{$b} <=> $count{$a} } keys %count)[0];
}
my @ary = qw/duck duck duck grouse moan complain grouse duck/;
print most_common(@ary), "\n";
--
Mike Whitaker: Sysadmin, Entropic Cambridge Research Labs
------------------------------
Date: 12 Jun 1998 22:02:16 +1000
From: bod@compusol.com.au (Brendan O'Dea)
Subject: Re: New module/pragma "enum.pm" (was "fields.pm")
Message-Id: <6lr5c8$die$1@duende.compusol.com.au>
In article <897482176.993603@thrush.omix.com>,
Zenin <zenin@bawdycaste.org> wrote:
>[posted & mailed]
>
>Zenin <zenin@bawdycaste.org> wrote:
> >snip<
>
> Benjamin Holzman has bought to my attention a spec designed
> by Tom Phoenix for an almost identical interface and pragma
> name for which Benjamin already had a first version of an
> enum.pm that implemented it.
The prefix and `..' ideas are pretty cool. I would prefer to be able to
do this at times:
use enum Foo => 1, Bar => 2;
or even:
use enum qw(Foo => 1 Bar => 2);
use enum qw(Foo = 1 Bar = 2);
rather than only:
use enum qw(Foo=1 Bar=2);
since I tend to put spaces around `='.
The non-quoted format also allows the use of arbitrary expressions to
set values:
use enum q(:OPT_), foo => 0x1, bar => 0x2, baz = 0x4;
use enum OPT_mask => OPT_foo|OPT_bar;
Here's a variation which allows both the quoted and non-quoted forms,
and also converts quoted octal and hex strings so that:
use enum A => 0x10;
use enum qw(B => 0x10);
gives A == B == 16 .
=== cut ===
package enum;
# use enum [:PREFIX][TAG][=DIGITS], [=[>]], [EXPR], ...
use strict;
use Carp;
no strict 'refs';
my $ident = '[^\W_0-9]\w*';
sub import
{
shift; # class
@_ or return; # Ignore 'use enum;'
my $pkg = (caller) . '::';
my $prefix = '';
my $index = 0;
my ($is_prefix, $tag, $tag2, $new_index, $use_oct);
local $_;
while (defined ($_ = shift))
{
croak "Can't define `$_' as constant (name contains invalid ",
"characters or is empty)"
unless ($is_prefix, $tag, $tag2, $new_index, $use_oct)
= /^(:?)(?:($ident)(?:\.\.($ident))?)?(?:=((0x?)?\d+))?$/;
# reset index if given =DIGITS
$index = defined $use_oct ? oct $new_index : $new_index
if defined $new_index;
# ignore quoted = or =>
shift if @_ and $_[0] =~ /^=>?$/;
# reset index if numeric EXPR follows
$index = defined $1 ? oct shift : shift
if @_ and $_[0] =~ /^(0x?)?\d+$/;
# reset prefix only
$prefix = $tag || '', next if length $is_prefix;
# reset index only
next unless defined $tag;
for (defined $tag2 ? $tag .. $tag2 : $tag)
{
my $n = $index++;
*{"$pkg$prefix$_"} = sub () { $n };
}
}
}
1;
__END__
Regards,
--
Brendan O'Dea bod@compusol.com.au
Compusol Pty. Limited (NSW, Australia) +61 2 9809 0133
------------------------------
Date: Thu, 11 Jun 1998 20:06:46 GMT
From: monica@qmaster.com
Subject: Perl & GDBM
Message-Id: <358037c3.13940164@calicool>
I'm having trouble linking perl (v5.003) with gdbm (v1.7.3). I was
told to test it using the following command, but it fails.
----------------------------------------------------------------------------------------------------------
# ./perl -e 'use GDBM_File;'
Can't locate GDBM_File.pm in @INC at /tmp/perl-ea23769 line 1.
BEGIN failed--compilation aborted at /tmp/perl-ea23769 line 1.
----------------------------------------------------------------------------------------------------------
Someone told me that I had to install gdbm first, then perl. That
doesn't make much sense considering the perl files were pre-compiled
(HP/UX 10) and simply copied over to the correct destinations.
Got any ideas? Your help would be greatly appreciated.
Monica.
monica@qmaster.com
------------------------------
Date: Fri, 12 Jun 1998 09:57:29 +0100
From: "Robin Smith" <r.d.smith@man0501.wins.icl.co.uk>
Subject: Re: Perl NT IIS4.0 - can't get Perl to work via the web
Message-Id: <3580ed34.0@145.227.194.253>
It is easier now in IIS 4. No registry editing is required.
You need to edit the properties of the server or web site, and in the home
directory tab, configure the application settings (half way down the tab).
This gives you a list of application mappings, where you need to add the
perl filetype, and the path to the perl.exe program. Putting %s on the end
will ensure parameters are passed to perl.
Robin Smith.
------------------------------
Date: Fri, 12 Jun 1998 09:49:47 +0100
From: James Sutherland <jasuther@dux.dundee.ac.uk>
Subject: Problem with MOMSpider
Message-Id: <3580EBAB.21C12688@dux.dundee.ac.uk>
HELP!
I have just installed MOMSpider on the University WWW server. After
installing it and creating an instruction file, I get:
Undefined subroutine &main::AF_INET called at lib/wwwhttp.pl line 106.
Where can I find &main::AF_INET? Some of the standard libraries refer to
AF_INET, but I can't find any sort of definition.
While I like and use Perl, I've not been using it all that long - what's
up here? BTW, the homepage for MOMSpider says the program needs Perl4 -
would that mean it can't run under Perl5? That would be a little odd,
surely?
I'm really pretty much in the dark here, so if anyone could help me out,
I'd be very grateful.
James Sutherland,
IT Services
University of Dundee.
------------------------------
Date: 12 Jun 1998 05:47:12 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: removing dups from a file
Message-Id: <6lqfd0$7go@mozo.cc.purdue.edu>
Michael Stearns <michael@datahost.com> writes:
}I have a text file with about 700 lines.
}I would like to remove duplicate lines from the file.
}Can someone recommend a good way to do this?
#!/usr/local/bin/perl -w
#pragma DWIM
while(<>){
if(!$btdt{$_}++){print;}
}
#...or something dammed close to that.
You now owe me. You can pay back your debt by reading a good perl
book, and helping someone else in this newsgroup with a similar
question. Keep your karma clean!
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: 12 Jun 1998 11:44:45 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: reverse sorting
Message-Id: <897651886.9108@cabal>
In <1dahfx9.sjgqjp14wk60lN@roxboro0-047.dyn.interpath.net> phenix@interpath.com (John Moreno) writes:
>Randal Schwartz <merlyn@stonehenge.com> wrote:
[...]
>> It is silly to sort in a void context...
>I don't know - Abigail might do so instead of using wait.
No she wouldn't, she might do so instead of sleep, and she might use it as
an alternative to dump but she would never use it as a replacement for
wait.
--
I'm a perl programer; if you need perl programing, hire me.
Please excuse my spelling as I suffer from agraphia; see the url. Support NoCeM
http://www.cit.nepean.uws.edu.au/~dformosa/Spelling.html http://www.cm.org/
I'm sorry but I just don't consider 'because its yucky' a convincing argument
------------------------------
Date: Fri, 12 Jun 1998 09:24:19 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Suche ein Perl Buch - Translation
Message-Id: <3580E5B3.71C22191@nortel.co.uk>
Urs Martini wrote:
>
> Hi!
>
> Ich bin auf der Suche nach einem Perl Buch das f|r Anfdnger verstdndlich
> aber auch f|r Fortgeschrittene nicht uninteressant ist.
> Kann mir da jemand hefen?
You should write English (lingua franca dil mundo, or sumtin like that)
Hi,
I am searching for a Perl book that can be understood by beginners but also
provides enlightenment for the advanced users. Can someone help me?
Well, I've got the usual pack of Learning Perl and Programming Perl. Learning
Perl (Llama) brings you quite a bit along the way to program Perl, and I think
it can be understood by people without any programming experience. Programming
Perl is a lot tougher, but an infinite knowledge resource.
--
____________________________________________________________
Frank Quednau
http://www.surrey.ac.uk/~me51fq
________________________________________________
------------------------------
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 2853
**************************************