[12979] in Perl-Users-Digest
Perl-Users Digest, Issue: 390 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 5 17:17:32 1999
Date: Thu, 5 Aug 1999 14: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)
Perl-Users Digest Thu, 5 Aug 1999 Volume: 9 Number: 390
Today's topics:
Re: My Last Words on => vs comma (Larry Rosler)
Re: mySQL & Perl -> Something simple <gellyfish@gellyfish.com>
newbie question: splitting hairs <bklimov@mitre.org>
Re: passing IO handle in reference to hash? <mwood@mhw.ULib.IUPUI.Edu>
Re: patten matching (Steve Manes)
Re: split array with \n? <laurens@bsquare.com>
Re: unus sed leo (Bart Lateur)
upload file <splinter@monmouth.com>
Re: Why is it.... [REPOST] <tchrist@mox.perl.com>
Re: Why is it.... <ltl@rgsun5.viasystems.com>
Re: Why no Perl books at Fry's? <elaine@chaos.wustl.edu>
Re: Windows NT + Perl <rootbeer@redcat.com>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 5 Aug 1999 13:37:08 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: My Last Words on => vs comma
Message-Id: <MPG.121395d1188a3fd3989de3@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <37a9e62c@cs.colorado.edu> on 5 Aug 1999 13:29:48 -0700, Tom
Christiansen <tchrist@mox.perl.com> says...
> In comp.lang.perl.misc,
> "Perl King" <perlking@hotmail.com> writes:
>
> So, Larry, since when have you taken to slumming at snotmail?
Yeah. Well. At 15:42 UTC today (six hours ago) I said:
"I will not continue this discussion here. I have already referred to
an extensive thread in comp.lang.perl.moderated, where I chose to post
the query in the first place in the hope of getting intelligent, well-
reasoned arguments either way. You certainly have not provided them
here."
But that didn't stick long, because he persisted and became even more
offensive with his idiocy.
...
> use constant PI => 3.14159265358979;
...
> thefunc(START => "+5m", FINISH => "+30m")
...
> $sepchar = grep(/,/ => @_) ? ";" : " ,";
...
> join($; => $x, $y, $z)
...
> print STDOUT join "\n" =>
> "Content-Type: text/plain",
> "",
> "This is a test of errors before output.",
> "Did it work?",
>
> Then there are the more, well, creative, uses in Chapter 16:
>
> kill 9 => $pid;
> kill -1 => $pgrp;
> kill USR1 => $$;
> kill HUP => @pids;
> if (kill 0 => $minion) { ... }
It has become very clear why you had no objection to the uses of => in
the draft of the paper on sorting that you graciously reviewed for us.
> :My advice? Use the language as it was meant to be used, and don't
> :try to decorate it!
>
> Do you already forget poetry, sir? Please produce a quote from Larry
> proving that this is what he meant. Considering that Larry editing the
> Perl Cookbook and didn't even produce the lightest of clucks in reviewing
> the cited material, I suspect you shall be hard-pressed to produce such
> a quote.
For other readers: That's The Other Larry, of course (aka *The* Larry).
My role in the Perl Cookbook was minuscule. But fun and rewarding. And
it got me an acknowledgment. And a free copy. :-) But I didn't
remember that I could download and grep the examples, as Matthew Bafford
did.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 5 Aug 1999 18:52:15 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: mySQL & Perl -> Something simple
Message-Id: <7ocmgv$lj$1@gellyfish.btinternet.com>
On Wed, 04 Aug 1999 14:32:20 EDT Perl King wrote:
> ObPerl: Use the => operator only in hash initialization.
Wrong. see perlop.
/J\
--
Jonathan Stowe <jns@gellyfish.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>
------------------------------
Date: Thu, 05 Aug 1999 16:18:02 -0400
From: Boris Klimovitsky <bklimov@mitre.org>
Subject: newbie question: splitting hairs
Message-Id: <37A9F179.CFF70F00@mitre.org>
Hi,
I have a file of three columns of values.
1 2 3
a b c
d e f
etc.
I'd like to be able to get the values of the second and third columns
and perform some tests on them. Rather, I have a working script that
does this, but am a little confused. The script is as follows:
#!/usr/local/bin/perl -w
$file = "list";
open (LIST, $file) or die "Cannot open $file: $!";
while (<LIST>) {
@line = split;
print "$line[1], $line[2]\n";
}
My question is: since the split uses a reg.exp to parse $_ (namely,
split(/\s+/,$_) )
why are $1, $2 ... $n not set?
Also, a second question:
would it be bad to have something like the following?
while (<LIST>) {
split; print "$_[1], $_[2]\n";
}
when I tried this, I got a message that using split to @_ is
deprecated... though it says on the split perlfunc page that split
without any arguments implicitly puts the values in @_. Why am I being
warned that the use is deprecated? And what should I use instead, to not
generate those warnings?
Couldn't find anything with this on deja.com (though I didn't check all
1900 results that my search came back with)... sorry if it's a FAQ.
------------------------------
Date: 5 Aug 1999 20:35:39 GMT
From: "Mark H. Wood" <mwood@mhw.ULib.IUPUI.Edu>
Subject: Re: passing IO handle in reference to hash?
Message-Id: <7ocsir$3hv$1@hercules.iupui.edu>
Tom Christiansen <tchrist@mox.perl.com> wrote:
> [courtesy cc of this posting mailed to cited author]
Thank you!
> In comp.lang.perl.misc,
> "Mark H. Wood" <mwood@mhw.ULib.IUPUI.Edu> writes:
> :I'm writing a merge program that needs to keep a zillion things all
> :associated with the files being merged, so I packed them all into a
> :couple of hashes:
> :
> : open(FILE1,"foo");
>
> Did you localize *FILE1?
No. I'm still studying this question.
> : $fyle1{handle} = FILE1;
>
> Probably you should store *FILE1 there instead.
Quite so. I misremembered my own code. Actually I had written:
$fyle1{handle} = *FILE1{IO};
but that didn't work out. I'm now using the typeglob, not the actual
handle.
> : $fyle1{eof} = 0;
>
> I always get nervous seeing keywords there. Oh well.
Good point. 'eof' replaced with 'atend'. I forgot about eof(). Can
you tell I write Perl aggressively but not very often?
[quotes from the perlop page snipped]
*blush* It seems I checked every page but the right one.
--
Mark H. Wood, Lead System Programmer mwood@IUPUI.Edu
A Brazil-nut is neatly packaged and tightly integrated. To turn it into
food, you must crack and remove the shell. I find that I feel the same
way about an increasing number of software products. *sigh*
------------------------------
Date: Thu, 05 Aug 1999 20:08:46 GMT
From: smanes@NOSPAM.HEREmagpie.com (Steve Manes)
Subject: Re: patten matching
Message-Id: <37a9eda6.23813206@news.panix.com>
On Wed, 4 Aug 1999 23:02:10 -0700, lr@hpl.hp.com (Larry Rosler) wrote:
>Two problems there: metacharacters in $string1 (fix with \Q)
Then the match would probably fail, as it should. But, yeah, quoting
the string is advisable.
>and performance relative to 'index'.
For a simple string compare, the regex overhead is a drop in the
bucket especially when you consider the speed and flexibility of
massaging sed results in $1, $', $` after the match.
------------------------------
Date: Thu, 5 Aug 1999 13:22:51 -0700
From: "Lauren Smith" <laurens@bsquare.com>
Subject: Re: split array with \n?
Message-Id: <7ocrr6$l29$1@brokaw.wa.com>
Tom Kralidis wrote in message <37A9E999.3F86F9E@ccrs.nrcanDOTgc.ca>...
>I am writing a script to execute a program on a list of files, which
are
>stored to an array. Problem is, the process has trouble moving to
>subsequent files after the first one? How can one split the array so
>that the process can run on each file? Can one split the array via
>newline?
Can one post some code to see where your mistake is?
In the meantime:
perlsyn # the 'foreach' section should be interesting
Lauren
------------------------------
Date: Thu, 05 Aug 1999 20:19:06 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: unus sed leo
Message-Id: <37a9ed91.877976@news.skynet.be>
Larry Rosler wrote:
>> "Unus sed leo", says the lioness, meaning "One, but [it is] a lion."
>
>How very clever of the animals in Aesop the Greek's fables to speak
>Latin!
And all the aliens in Star Trek speak English.
Oh, you mean "Latin instead of Greek"? No comment...
Bart.
------------------------------
Date: Thu, 5 Aug 1999 16:17:59 -0400
From: "Matt" <splinter@monmouth.com>
Subject: upload file
Message-Id: <7ocrg1$o33$1@news.monmouth.com>
Hi,
I've asked a question about CGI.pm a few days ago and how to use it to
retrieve an uploaded file and save it to disk. Someone told me things to
read but that didn't help. Its very hard for me to understand and doesn't
give a full example.
Could someone please help me in detail?
On the web page there is a file field. Say its named "image".
So the binary contents of "image" get sent to the script and I retrieve them
how?
Like this?
$image = $FORM{'image'}
assuming $FORM{'image'} was the associative array I was using.
Then how would I save it as a binary image file to a specific location?
chdir (location); right?
Then what?
-Matt
------------------------------
Date: 5 Aug 1999 14:48:47 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Why is it.... [REPOST]
Message-Id: <37a9f8af@cs.colorado.edu>
[This resurrected article was a casualty of the
rogue cancelbot from ukmail.virtualvillage.co.uk]
In comp.lang.perl.misc, Chris Goodwin <archer7@mindspring.com> writes:
:why is it that I, who have only been hacking Perl for ~3 days, can read
:through the documentation and the previous newsgroup postings (7000+ of them
:on my server) and write up a 122-line program that does what I want it to do
:(which is turn my text into my HTML -- not *entirely* finished yet, but the
:rest is details -- I've gotten over my hurdles), all *without* having to ask
:anyone for help, while other people around here, who apparently have been
:hacking Perl for longer than I, have to come in and ask the same questions
:over and over?
Perhaps because you were born with at least a modicum of native
intelligence, resourcefulness, motivation, and perseverance?
Consider how frankly dim a bulb the "average" person is, all in all.
Now, consider that nearly 50% of the people out there are below this
already underwhelming state. This is the crux of the problem.
Ignorance can be cured, as you have so capably demonstrated through your
own researches. Stupidity, however, is a crippling disability which is
both congenital and incurable. Fortunately, we always seem to need people
to pick up trash or give out fries at the drive-in window. Unfortunately,
many of these people get the idea in their heads that they're going
to become "HTML programmers". And as yourself have doubtless noticed,
many of these come here in desperation with their hands outstretched,
begging for alms. One does what one can for such supplicants, but too
often one can in the long run do nothing.
There's this dirty little secret that nobody likes to talk about in
public today, for it is phenomenally politically incorrect to do so--as
I predict the ensuing followups to this posting shall presently prove.
That dirty little secret is that there exists a thing called "talent",
and that either you have it, or you don't.
Some people have a knack for programming, but most people don't.
Not everyone is born to do everything. As far as the case at hand is
concerned, not everyone has the raw mental horsepower combined with
that special problem-solving thinking style that it takes to be a good
programmer. Nobody wants to hear it said, but their unwillingness to
listen does not render any less true the observation that not everyone
is cut out for programming. That's just the way it is, and the sooner
people recognize and accept this, the sooner they'll be able to cease
frustrating themselves and others, and get on with their lives.
Talent cannot be instilled.
Talent cannot be learned.
Talent cannot be taught.
Talent cannot be bought.
Talent cannot be created.
Very few are born gifted, but that's the only way you get it--which
is why, after all, it's called a gift. Seldom does a brilliant
mathematician, physicist, composer, or computer programmer spontaneously
appear late in life, having just spent their previous three or four
decades flipping burgers. The gifted and the talented amongst us are
noticed early. They are a light that burns too brightly to ignore.
Their natural gifts cannot be hidden from the world, their talents
suppressed. They can be nurtured or they can be starved, yet genius
remains something born and not made.
Great programmers are artists, coding artisans if you would, whose
insights and inspirations are irreproducible and irreplaceable.
You can't just fire one great programmer in and then turn around and hire
yourself another. Even if you managed to find another great programmer,
it wouldn't be the same.
Genius is unique.
The traditional engineering techniques and orderly production schedules
that old-style managers try to apply to programming are not always
well-suited to that discipline, for it is often more one of inspiration
than it is of perspiration. This drives profit-minded businessmen with
concrete deadlines completely crazy with frustration, because they are
unable to predict those flashes of brilliance from gifted individuals
that may be critical to their venture.
The quality and quantity of work created by a great programmer are
immeasurably superior to that produced by any possible number of poor
programmers combined. No number of accountants and tax preparers can add
up to another Gauss or Einstein, nor can any quantity of house painters
be combined to create a Leonardo or Rembrandt. And no matter how many
script kiddies and "HTML programmers" you care to gather together, you
will never in that aggregate mass arrive at the equivalent of Donald
Knuth or Ken Thompson.
Fine, so not everyone is cut out to become a great programmer. So what?
Can't anyone be at least a regular programmer?
Well no, I'm afraid not. Not everyone is cut out to be any sort
of programmer whatsoever. They just don't have the gift it takes.
The explosion of the net and the disparagement of formal education have
combined to generate a popular but perilous myth that anyone can be
a programmer. They can't.
This doesn't mean that the merely average person cannot ever be
educated, nor that in them cannot be instilled an abiding sense of
hard work and an honest desire for achievement. Certainly these are
worthy goals for anyone; there is no dishonor in hard work, whether it
be in house-keeping or in chemistry. These people can still lead happy
and fulfilling and productive lives--just perhaps not in programming.
Sometimes you'll find that there are people who just don't "have it"
and never will; you can usually see this in a person pretty early on.
You should no more try to entice these people into a career in rocket
science or computer programming than should you attempt to teach a pig
to sing. The appropriate biological hardware just isn't there, and all
you'll end up with is a lot of frustrated and unhappy people. And pigs.
Returning to your original question, motivation is uncommon, perseverance
less common still--and intelligence a rare trait indeed. But rarer
by far than any of these is that most elusive and valued of gifts:
creativity, which is priceless. Be not surprised, then, how scarce
are the individuals who actually manifest all four of these attributes.
Be instead contented that in you at least some of these must truly reside
for you to have done what you have reported.
Good luck to you,
--tom
--
There is no reason for any individual to have a computer in their home. --Ken Olsen, 1977
------------------------------
Date: 5 Aug 1999 19:55:53 GMT
From: lt lindley <ltl@rgsun5.viasystems.com>
Subject: Re: Why is it....
Message-Id: <7ocq89$9sa$1@rguxd.viasystems.com>
Abigail <abigail@delanet.com> wrote:
:>David Cassell (cassell@mail.cor.epa.gov) wrote on MMCLXIV September
:>MCMXCIII in <URL:news:37A88A10.A96611AC@mail.cor.epa.gov>:
:>()
:>() BTW, why is it acceptable to tell people that they have no
:>() athletic ability, no musical ability, etc., but you
:>() are a creep if you try to tell someone they have no gift
:>() for programming?
:>I don't believe in this crap. Programming isn't some gift or art.
:>Programming is something you can learn. Just like car mechanics.
:>Or surgery. Or glass blowing. Or shoe repair.
:>Some people are better learners than others. Some people aren't interested
:>to learn programming, or how to repair shoes. Some jobs require more
:>learning than others. But there's no such thing as a born programmer.
I tried to teach my wife algebra a few times. She said she really
wanted to learn. I could litterally see her brain turn off and
her attention wander as soon as any mathematical concept was
presented. You could say that it was because I am not a good teacher,
and there might be truth there, but I could see the same thing happen
as she struggled to read a paragraph in the high school algebra text.
Many times over the years I have seen this same phenomenon.
She has a Bachelor of Arts degree in Interior Design. She kicks ass
in Trivial Pursuit. Her ability to do associative type things like
plays on words is great. She just doesn't think about things and see
the world like most people who are good at logical/mathematical
type things.
Some might argue that she was/is shaped by her environment. Others
will say that it is inherited. I say it doesn't matter. By the time
a person is an adult, they will either have the capacity to learn
programming concepts or they won't. It is a rare person who can
cross this line later in life. I've never really known anyone who
could. People who can do it were able to do basic math in school,
whether or not they actually liked it.
People fall all along the spectrum in their ability to learn this kind
of skill. Some can't do it at all. Others are slower and require
more help, but they can contribute.
So, although there may not be any such thing as a "born programmer,"
it may be fair to say that there are people who should try to make
the best of the other abilities with which they have been blessed.
--
// Lee.Lindley /// Programmer shortage? What programmer shortage?
// @bigfoot.com /// Only *cheap* programmers are in short supply.
//////////////////// 50 cent beers are in short supply too.
------------------------------
Date: Thu, 05 Aug 1999 16:28:56 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: Why no Perl books at Fry's?
Message-Id: <37A9F3EE.BAC822C4@chaos.wustl.edu>
> :: Probably Foyle's in Charing Cross Road, as (a) it has a huge academic
> :: stock and (b) it displays by publisher (even in the fiction department).
>
> Indeed, it is.
*sigh* Now _there_ is a world class bookstore.
I will note that few bookstores have adequate organisation of the
computer books. Though, I do think it is odd that Fry's would be bereft
of Perl books.
e.
------------------------------
Date: Thu, 5 Aug 1999 13:43:56 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Windows NT + Perl
Message-Id: <Pine.GSO.4.10.9908051340000.9452-100000@user2.teleport.com>
On Thu, 5 Aug 1999, Flash Fire wrote:
> can anyone tell me what the default directory for perl is on a nt machine
I think you want section three of the FAQ, under the question "How can I
get '#!perl' to work on [MS-DOS,NT,...]?". The perl-for-Win32 FAQ may also
be helpful.
> The page you are looking for is currently unavailable. The Web site might be
> experiencing technical difficulties, or you may need to adjust your browser
> settings.
Sounds like a server problem. You should probably check the docs, FAQs,
and newsgroups about servers for more information. If you (or anyone else
reading this) don't know how to find those things, please let me know.
Also, when you're having trouble with a CGI program in Perl, you should
first look at the please-don't-be-offended-by-the-name Idiot's Guide to
solving such problems. It's available on CPAN.
http://www.perl.com/CPAN/
http://www.perl.org/CPAN/
http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html
http://www.perl.org/CPAN/doc/manual/html/pod/
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 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.
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 V9 Issue 390
*************************************