[11409] in Perl-Users-Digest
Perl-Users Digest, Issue: 5009 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 1 06:07:25 1999
Date: Mon, 1 Mar 99 03:00:13 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 1 Mar 1999 Volume: 8 Number: 5009
Today's topics:
Re: does perl discourage obfuscated code? (was Re: Perl ran@netgate.net
Re: FAQ 4.53: What happens if I add or remove keys from (David Combs)
FAQ 7.7: Why do Perl operators have different precedenc <perlfaq-suggestions@perl.com>
Re: forum program wanted (Peter Palfrader)
Re: gethostbyname bug? (Tye McQueen)
Re: nmake, adding modules in Win 98 <i.hate@spam.com>
Re: Numeric Sort <coyote38@pacbell.net>
Re: Perl REQUIRE question (Bart Lateur)
The truth about the Pentium III chip and ID --- **boyco (Boycott Swintel)
Re: Tied hashes and locking <jdf@pobox.com>
Re: What is %h=undef (assigning undef to a hash) suppos <tchrist@mox.perl.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 1 Mar 1999 08:48:46 GMT
From: ran@netgate.net
Subject: Re: does perl discourage obfuscated code? (was Re: Perl evangelism)
Message-Id: <7bdk9e$krr$1@remarQ.com>
In <19990301.003811.9v7.rnr.w164w@locutus.ofB.ORG>, Russell Schulz <Russell_Schulz@locutus.ofB.ORG> writes:
>I'm sure everyone will know I meant to say `write-only', but... oops.
Oh. I thought you meant "execute-only" ;-)
------------------------------
Date: Mon, 1 Mar 1999 06:55:21 GMT
From: dkcombs@netcom.com (David Combs)
Subject: Re: FAQ 4.53: What happens if I add or remove keys from a hash while iterating over it?
Message-Id: <dkcombsF7wLwA.MF1@netcom.com>
In article <7b3h2a$n0h$1@nnrp1.dejanews.com>, <droby@copyright.com> wrote:
>In article <7auqo0$a7m$1@fir.prod.itd.earthlink.net>,
> "Ken Hirsch" <kenhirsch@myself.com> wrote:
>>
>>
>> Yes, but I think it makes it much more likely that people will actually read
>> each answer before posting their repetitive questions, which is even more
>> annoying.
>>
>
Some uses of my perl-egrep aliases::
gperlfaq -w dup # gplfaq is csh ALIAS: "egrep on perlfaqs.pod | SED".
gperlfaq -w 'head2.*ask' <== Gets pats ONLY on HEADING lines.
gperlfaq -w '=head2' | head <== Gets first ten HEADING lines.
gperlfaq -A20 'head2.*how do you do foo' (gnu-egrep) heading + 20 lines.
LIKEWISE: gperlpod
alias gperlfaq 'egrep -in \!* /david3/from_netcom-dir1/perl-stuff-symlink/perl5.005_02/pod/perlfaq*.pod | sed "s;/david3/from_netcom-dir1/perl-stuff-symlink/perl5.005_02/pod/;;" '
alias gperlpod 'egrep -in \!* /david3/from_netcom-dir1/perl-stuff-symlink/perl5.005_02/pod/*.pod | sed "s;/david3/from_netcom-dir1/perl-stuff-symlink/perl5.005_02/pod/;;" '
------------------------------
Date: 27 Feb 1999 05:32:16 -0700
From: Tom Christiansen <perlfaq-suggestions@perl.com>
Subject: FAQ 7.7: Why do Perl operators have different precedence than C operators?
Message-Id: <36d7e5d0@csnews>
(This excerpt from perlfaq7 - Perl Language Issues
($Revision: 1.24 $, $Date: 1999/01/08 05:32:11 $)
part of the standard set of documentation included with every
valid Perl distribution, like the one on your system.
See also http://language.perl.com/newdocs/pod/perlfaq7.html
if your negligent system adminstrator has been remiss in his duties.)
Why do Perl operators have different precedence than C operators?
Actually, they don't. All C operators that Perl copies have the same
precedence in Perl as they do in C. The problem is with operators that C
doesn't have, especially functions that give a list context to
everything on their right, eg print, chmod, exec, and so on. Such
functions are called "list operators" and appear as such in the
precedence table in the perlop manpage.
A common mistake is to write:
unlink $file || die "snafu";
This gets interpreted as:
unlink ($file || die "snafu");
To avoid this problem, either put in extra parentheses or use the super
low precedence `or' operator:
(unlink $file) || die "snafu";
unlink $file or die "snafu";
The "English" operators (`and', `or', `xor', and `not') deliberately
have precedence lower than that of list operators for just such
situations as the one above.
Another operator with surprising precedence is exponentiation. It binds
more tightly even than unary minus, making `-2**2' product a negative
not a positive four. It is also right-associating, meaning that
`2**3**2' is two raised to the ninth power, not eight squared.
Although it has the same precedence as in C, Perl's `?:' operator
produces an lvalue. This assigns $x to either $a or $b, depending on the
trueness of $maybe:
($maybe ? $a : $b) = $x;
--
QVIDQVID LATINE DICTVM SIT PROFVNDVM VIDITVR
------------------------------
Date: Sun, 28 Feb 1999 23:14:45 GMT
From: palfrader@usa.net (Peter Palfrader)
Subject: Re: forum program wanted
Message-Id: <36d9cd68.6745665@news.uibk.ac.at>
On Sun, 28 Feb 1999 21:01:43 +0100, Ulrike <ulrikestar@hotmail.com>
wrote:
>Hi perl experts!
>
>I'm looking for a perl program which allows a threaded discussion
>forum on a web page. It would also need to have administration features.
>If
>anyone out there has seen anything that could help me, shareware or
>even freeware programs, I would really appreciate it. Even any advice
>on where I could search further would be great, or which programs are
>the best as there are so many out there it gets a bit confusing. Well
>thanks very much for listening and I hope to hear from you soon.
>
>Ulrike.
jaz@netalive.org has written a forum script which has all you need but
threaded discussion. But I know he is working on a version with
threaded disc. or perhaps he even finished it already.
Try to contact him.
--
Weasel mailto:palfrader@writeme.com
-----------------------------------------------------------------
"With a rubber duck, one's never alone"
-- The Hitchhiker's Guide to the Galaxy
------------------------------
Date: 28 Feb 1999 16:29:48 -0600
From: tye@fumnix.metronet.com (Tye McQueen)
Subject: Re: gethostbyname bug?
Message-Id: <7bcg0s$3ci@fumnix.metronet.com>
"Haye Chan" <haye@cs.cornell.edu> writes:
) I am using gethostbyname to get the list of IP addresses for a host. However
) the implementation in
) my version of Perl
And what might that be?? Please, I don't read minds.
) It only gives me one IP address,
I think that the Win32 C run-time library has this same bug.
--
Tye McQueen Nothing is obvious unless you are overlooking something
http://www.metronet.com/~tye/ (scripts, links, nothing fancy)
------------------------------
Date: Sun, 28 Feb 1999 22:34:29 -0000
From: "Weapon" <i.hate@spam.com>
Subject: Re: nmake, adding modules in Win 98
Message-Id: <7bcg42$5qb$1@uranium.btinternet.com>
Jonathan Stowe wrote in message <7bc04i$d3$1@gellyfish.btinternet.com>...
>In comp.lang.perl.misc tbird99@my-dejanews.com wrote:
>> I am trying to add modules for Perl in Win 98. I am using Perl v5.005_02,
and
>> the path is correct. I get the error, "Bad command or file name" whenever
I
>> try to do the nmake step for adding a module. Am I doing something wrong?
>>
>
>You probably have some other required tool missing - I would suggest using
>PPM to install the module.
>
>/j\
>--
>Jonathan Stowe <jns@btinternet.com>
>Some of your questions answered:
><URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
>Hastings:
<URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
nmake is a make utility for a C compiler, probably the GNU port to Win32.
You need a C compiler to compile it. It looks like the module is written in
C and not Perl.
Do a good search on 'Win32 GNU C Compiler' in you fave search engine.
Weapon
------------------------------
Date: Sun, 28 Feb 1999 19:37:32 -0800
From: "coyote38" <coyote38@pacbell.net>
Subject: Re: Numeric Sort
Message-Id: <AYnC2.5240$8N5.58707@typhoon-sf.pbi.net>
OK, 2nd try. Larry Rosler's solution is more elegant.
####################################################
#! /usr/bin/perl5
# If you don't get the filename as an arguement
if(! $ARGV[0])
{
# prompt for path/filename
print "Name of file you you want to process?\n";
# read it in
$fileName = <STDIN>;
# get rid of the pesky return.
chomp $fileName;
}
else
{
$fileName = $ARGV[0];
}
# open the file and give it a handle
open(INFILE, "<$fileName") or die "Couldn't open $fileName for reading\n";
# do the same for an output file
open(OUTFILE, ">$fileName.out") or die "Couldn't open $fileName.out for
writing\n";
while($nextLine = <INFILE>) # read in the lines until end of file reached
{
# remove the return character(s)
chomp $nextLine;
# match with memory the non-digit characters
$nextLine =~ /(\D+)\s/;
# the parenthesized match above
$name = $1;
# the remaining string after the match
$remainder = $';
# split on space into an array
@theNumbers = split(/\s/,$remainder);
# sort the array descending numerically
@theNumbers = sort {$b <=> $a} @theNumbers;
# join the array into a single string with space separators
$theNumbers = join(' ',@theNumbers);
# print it to the OUTFILE
print OUTFILE "$name $theNumbers\n";
}
close INFILE; # cleanup
close OUTFILE; # cleanup
print "All done.\n";
####################################################
golfer@usa.net wrote in message <36d8d902.11330469@news.flash.net>...
>Was wondering if someone could help me. I have a tab delimited text
>file with the following on each line (example):
>
>Pete 56 23 88 99 23 2 8
>Mike 99 32 45 12 11 8 90
>
>What I want to do is sort these numerically from highest to lowest
>written to a tab delimited file resulting in
>
>Pete 99 88 56 etc
>Mike 99 90 45 etc
>
>Thanks for the help, I very new to perl and have read about sorting
>but can't get a numeric sort to work.
------------------------------
Date: Sun, 28 Feb 1999 22:49:14 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Perl REQUIRE question
Message-Id: <36d9c677.2702364@news.skynet.be>
[I won't post to that defunct newsgroup]
John wrote:
>How does the Perl REQUIRE function work? Is the file listed in the require
>function loaded when the line that contains the REQUIRE function is reached
>or as soon as the PERL file that contains the REQUIRE function is loaded?
It's "require", not REQUIRE. Perl is case sensitive.
require()loads the file you mention, at the moment it's *executed*, but
only after checking it's not already loaded. Bare code in the file is
executed, so you can check for yourself by including some
print STDERR "I'm here!\n";
statements.
>The reason I ask is that I was wondering if I could speed up the performance
>of a perl script by not having the whole script loaded at once. If I break
>up the
>script into commonly used and non-commonly used parts and if I only
>load the parts that are in demand it might speed things up???
You're confusing require() with use(). require() works as you would
like. use() is run as soon as the line is compiled, in pretty much the
same way as require(), plus if there's a sub import() in the file, it is
run as well.
Bart.
------------------------------
Date: Sun, 28 Feb 1999 22:20:21 GMT
From: swintel@badchips.com (Boycott Swintel)
Subject: The truth about the Pentium III chip and ID --- **boycott info**
Message-Id: <36ddc0ca.4718754@news.earthlink.net>
Take the Pentium III Boycott Survey
http://mail.infotrieve.com/isurvey/index.cfm?vendorid=6045&formid=F0006045
Pentium III chip with the individual serial number that can
track your web surfing and buying habits can now have the ID number
turned on and off by software. Following some links I found the
www.fightdivx.com website and noticed that they have a Intel Boycott
page with links, quotes and info on why you should boycott the
invasion of privacy Pentium III chips. Just like everyone suspected,
the ID number can be taken without a customers knowledge. Just like
cellular phone fraud, once someone has your unique ID number, they
could pose as you on the internet. Do not be fooled by reports that
this problem is fixed because Intel disabled this feature by software
on their up coming chips. Information is power. They want to know
your surfing and buying habits. That is what this is all about. Here
is the link to the page with the boycott info and links.
http://www.fightdivx.com/intelboycott.htm
Also you will find a Boycott Intel screen saver and banner on their
page above. Spread it around.
------------------------------
Date: 28 Feb 1999 12:25:18 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: "Juho Cederstrvm" <cederstrom@removethis.kolumbus.fi>
Subject: Re: Tied hashes and locking
Message-Id: <m34so6xwxt.fsf@joshua.panix.com>
"Juho Cederstrvm" <cederstrom@removethis.kolumbus.fi> writes:
> Do I have to lock a file when I'm using tie or dbmopen ? In other
> words, do those functions have automatic locking or something like
> that ?
If you have the cash, you might seriously consider buying the Ram
book, _Perl Cookbook_, published by O'Reilly. Section 14.5 is
entitled "Locking DBM Files", and relates to your question. I believe
that all of the code from the book is available here:
ftp://ftp.oreilly.com/published/oreilly/perl/cookbook/
In general, you must devise your own locking scheme using an extra
lockfile.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: 27 Feb 1999 06:55:04 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: What is %h=undef (assigning undef to a hash) supposed to do ?
Message-Id: <36d7f938@csnews>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, bart.lateur@skynet.be (Bart Lateur) writes:
:>Really? You find that obvious? I would first try to find out why
:>it said it couldn't post.
:
:I don't think he has access to the source code...
And your point would be...?
--tom
--
"Contempt, rather than celebration, is the proper response to
advertising and the system that makes it possible." --Neil Postman
------------------------------
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 5009
**************************************