[16265] in Perl-Users-Digest
Perl-Users Digest, Issue: 3677 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jul 15 09:05:25 2000
Date: Sat, 15 Jul 2000 06:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <963666309-v9-i3677@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 15 Jul 2000 Volume: 9 Number: 3677
Today's topics:
Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!! <nnickee@nnickee.com>
Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!! <nnickee@nnickee.com>
Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!! <nnickee@nnickee.com>
Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!! <nnickee@nnickee.com>
Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!! <nnickee@nnickee.com>
Re: Bottleneck? Array or writing - neither? <nnickee@nnickee.com>
Re: Flock unsupported on which systems? <bart.lateur@skynet.be>
Re: Is there a better way (Multi-dimen. Arrays) (Keith Calvert Ivey)
Re: local and use strict <bcaligari@shipreg.com>
Locking a file martin@radiok2r.de
Perl can't add ! <stuart@unidev.com>
Re: Perl can't add ! <bart.lateur@skynet.be>
Re: Perl Rocks!(OT?) <bart.lateur@skynet.be>
Re: Perl Rocks!(OT?) <mauldin@netstorm.net>
Re: Problems running the perl debugger (Joe Brenner)
Re: The newbie question <bart.lateur@skynet.be>
Re: The newbie question <godzilla@stomp.stomp.tokyo>
Re: The newbie question <godzilla@stomp.stomp.tokyo>
Threading and ActiveState Perl 616 on Win32 <SCook@pobox.com>
Time in mili-seconds martho@my-deja.com
Re: Trying to use an array as a hash value (Keith Calvert Ivey)
Re: Trying to use an array as a hash value <bart.lateur@skynet.be>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 15 Jul 2000 04:29:04 -0500
From: Nnickee <nnickee@nnickee.com>
Subject: Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!!
Message-Id: <77D4C4C83E200F68.0DF372815EE68FE5.DE3330CA47AC31E2@lp.airnews.net>
On Fri, 14 Jul 2000 19:09:19 GMT, someone claiming to be
p3rlc0dr@my-deja.com said:
>In article
><E5E389A85215E93F.923AA62CD45C0A36.6CFCE0526940F854@lp.airnews.net>,
> nnickee@nnickee.com wrote:
[ snipped my gushing ]
>I sir am an agent of the truth. You are an operative of lies, smoke and
>mirrors, and deceit. WAKE UP.
And I, Sir, am no Sir, thank you very much. I am no one's operative
other than my own.
I am also very much awake, and I thank you for your concern regarding
my state of wakefullness, but I assure you that it is unnecessary, as
I do own an alarm clock and know how to use it. In addition, I know I
am very much awake because I do not suffer from walking, talking or
typing in my sleep.
>Please don't come crying to the welfare office when Randal drinks the
>dollars out of your pockets or to the government when he "innocently"
>runs crack on all of your systems and sends you all mail from your own
>accounts. And there's no reason to feel bad that our hero was having
>his home refurnished and getting laser corrective surgery, while
>collecting money for his defense fund from netizens and bragging about
>how much money he was spending on IRC #perl.
Have you ever heard of the word "libel"? If you don't own a
dictionary, might I suggest
http://www.dictionary.com/cgi-bin/dict.pl?term=libel ?
[ Hint: it doesn't have to be a false statement in order to qualify
as libel ]
Because I'm feeling generous tonight, I'll give you another couple of
clues at no charge:
1) Don't believe everything you hear or read. Just because it's in
print doesn't make it fact.
2) Even when reading something that actually is true, the likelihood
of having the *whole* truth there is quite slim
3) Or continue to believe everything you hear and read, and by the
way, I have some prime ocean-front property in Oklahoma for sale very
cheap... interested?
>Yes, thank you Randal. For everything.
Nnickee
------------------------------
Date: Sat, 15 Jul 2000 04:29:05 -0500
From: Nnickee <nnickee@nnickee.com>
Subject: Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!!
Message-Id: <C400E23D49A838EA.3865CFAA0938C69D.6848AC41AC3F664C@lp.airnews.net>
On 14 Jul 2000 20:42:29 GMT, someone claiming to be The WebDragon
<nospam@nospam.com> said:
>In article
><8AC845C22FF6B9FE.A50105420F4ABB68.8E8371E67BDEB239@lp.airnews.net>,
>nnickee@nnickee.com wrote:
> | Ah. Thank you for explaining, and I do apologize for gushing. It's a
> | silly female trait that does come out on occasion. I'll try to keep
> | that under better control in the future. :)
>Hey some of us *like* those 'silly female traits'. :D
<s> Thank you. I'm sure I'll slip up again at some point in the
future. Just because I'm going to try to control it doesn't mean I'll
succeed 100% of the time (darnnit :)
Nnickee
------------------------------
Date: Sat, 15 Jul 2000 04:29:07 -0500
From: Nnickee <nnickee@nnickee.com>
Subject: Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!!
Message-Id: <7B84D025E0CEC66B.E81A55ACA1D8A768.67F0C6CB6713E608@lp.airnews.net>
On Fri, 14 Jul 2000 22:38:22 GMT, someone claiming to be
nvp@spamnothanks.speakeasy.org (NP) said:
>On 14 Jul 2000 22:04:18 GMT, David H. Adler <dha@panix.com> wrote:
>: JARF: The sigfile of a new generation? :-)
>I've got no beef with Randal, but: please, no. :-) Without ruining
>anyone's fun with JARF and such pursuits, let's keep things in
>perspective... Randal and other folks who write Perl books are
>*technical professionals*,
Yup. Believe it or not, I am a technical professional too (for some
value of professional). And I'll certainly admit that when certain
customers of mine gush all over me, I get somewhat uncomfortable. On
the other hand, when I've had a day of seemingly everybody in the
world screaming at me, a customer who goes out of his way to say
"thank you, you're the greatest, will you marry me?" really makes my
day.
>not members of The Backstreet Boys or Blue
>Oyster Cult. We do not point our fingers at women so that our roadies
>can corral them into our hotel rooms. We do not limit ourselves to one
>string on the bass guitar while we chug Jack Daniel's. And, with the
>exception of Randal, perhaps, we wear pants to work.
I think that just might fall into the category of TMI :)
Seriously, I do get a bit star-struck at times, but not over the
Backstreet Boys or Blue Oyster Cult (the Beach Boys, OTOH... :). It's
just because I've always put programmers up on a pedestal; always seen
them as better (or at least more intelligent) than normal folks.
Y'all think I was bad earlier... shoulda seen my reaction a few years
ago when Nico emailed me a little note along with my very own winzip
key :)
>Let's not go too overboard, okay? We're people just like everybody
>here (except "Ganesha", of course). We appreciate it!
I'll do my best, but I can't promise I'll always succeed, especially
at first. No more "JARF" lines from me though :)
Nnickee
------------------------------
Date: Sat, 15 Jul 2000 04:29:06 -0500
From: Nnickee <nnickee@nnickee.com>
Subject: Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!!
Message-Id: <5BA278CA97FF0806.4B6E4D8D62AD8FE3.3FDB08B2714511D6@lp.airnews.net>
On 14 Jul 2000 22:04:18 GMT, someone claiming to be dha@panix.com
(David H. Adler) said:
>>Just Another Randal Fan
>JARF: The sigfile of a new generation? :-)
<g> I just thought it was cute (ack, another silly female thing) and
that it might elicit a few chuckles. Don't worry, folks, I won't be
signing every post with it :)
Nnickee
------------------------------
Date: Sat, 15 Jul 2000 04:29:08 -0500
From: Nnickee <nnickee@nnickee.com>
Subject: Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!!
Message-Id: <A65563BB6ECEC889.A6505C306CF381B1.9F81FEF1935BC598@lp.airnews.net>
On Fri, 14 Jul 2000 21:48:17 +0100, someone claiming to be Rosemary I
H Powell <rosie@dozyrosy.plus.com> said:
>Well said. I think people don't realise (or they tend to forget!) what a
>wealth of expertise is available here. Folowing a few rules is surely a
>small price to pay for it...
<nod> That's exactly what I was trying to say. If I were to attempt
to put together a "rules for posting questions to c.l.p.m" it would
probably go something like this: [ thee's and thou's and ye's are
most likely used incorrectly at least 90% of the time in the
following, but it's just off the top of my head ]
1. Thou shalt not post to c.l.p.m until thou hast lurked in said
group for a period of no less than 2 weeks and actually read every
single post posted in those 2 weeks - (alternately thou mayest taketh
thy butt over to deja news and read the previous 2 weeks worth of
postings in one sitting so that thou mayest post thy first question to
said group)
2. Thou shalt not post any question to c.l.p.m before thou tryest to
find thine own answer. Thee may find 99% of thine answers in the
excellent documentation that cometh with thine local installation of
Perl, or at http://www.perl.com or by searching deja news.
3. Thou shalt not post in Jeopardy Style. If thou knowest not what
Jeopardy Style refers to then thou certainly hath not lurked long
enough to be allowed to post to c.l.p.m.
4. Thou shalt not post a request for someone to write thy script for
thee, nor shall ye demand answers to be emaileth to thee.
5. Thou shalt not take the name of Larry Wall in vain.
6. Thou shalt not post untested scripts in response to another's plea
(applies to all newbies as well as most others with exceptions made
for the Gurus).
7. Thou shalt not ask cgi or web server configuration questions.
8. Thee should always use strict and -w. If thou knowest not what
strict and -w mean then thou hast either not lurked long enough and/or
thou hath not attempted to find thine own answers.
9. Thou shalt not gush all over the Gurus. Thee are expected to
thank them when they helpeth thee.
<s>
Ok, that's all I could think of in 3 and a half minutes :)
Nnickee
------------------------------
Date: Sat, 15 Jul 2000 04:29:09 -0500
From: Nnickee <nnickee@nnickee.com>
Subject: Re: Bottleneck? Array or writing - neither?
Message-Id: <24CC16FF2A2BEE6E.7EAC47CD8D1D5BB7.2C7CEC192750218C@lp.airnews.net>
[ Jeopardectomy performed --
please put your reply after (or between) quoted text ]
On Wed, 12 Jul 2000 21:15:09 -0700, someone claiming to be Eric
<esmithNOesSPAM@exeter.com.invalid> said:
>Nnickee <nnickee@nnickee.com> wrote:
>>Uh oh...
<snip>
>>You might want to check the size of your $tetragraphs file when
>>you get to work tomorrow, just to be on the safe side :)
>Thanks, will do. I'm fairly confident that it will eventually
>for two reasons - I've tested it on smaller starting texts and
>they've been fine, and also I modified it (so it didn't do the
>counting or scoring) and had it run on a really fast server once
>night when it wasn't too busy and it eventually got through it
>and output a huge 10meg file, but still completed.
You call 10mb huge? <s> Don't forget, I had a 1.2gig output file.
Makes your 10mb file seem rather wimpy in comparison, don'tcha think?
Of course, since mine was supposed to be far smaller than 1 puny
little mb, I really shouldn't be talking :)
>This onc was great though, a small (relatively) file and fast -
>I'm so happy!
I am still curious though -- what was the size of your $tetragraphs
file when you got to work the next morning?
Nnickee
------------------------------
Date: Sat, 15 Jul 2000 10:23:47 +0200
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Flock unsupported on which systems?
Message-Id: <og60nscg6v80q7r3aef2hg82oj4n7ffmll@4ax.com>
Clinton A. Pierce wrote:
>> "perldoc perlport" doesn't say flock() is not supported on Windows systems... So would it be safe to
>> assume that it IS supported?
No it's not.
>Systems which don't have flock() generally don't need it. (Win95/Win98)
>The existance of flock can be tested for with eval.
But that's annoying!
I prefer the way the DJGPP DOS Perl handles it: flock() is simply a
noop. If only the Win32 Perls behaved the same way. Life would be much
nicer.
--
Bart.
------------------------------
Date: Sat, 15 Jul 2000 10:00:41 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: Is there a better way (Multi-dimen. Arrays)
Message-Id: <39723612.36611760@news.newsguy.com>
James Mauldin <mauldin@netstorm.net> wrote:
>This assumes that you know for sure that there is whitespace at the end of each
>line, otherwise you'd have to use separate statement:
> s/\s+$//;
> $_ .= "\n";
s/\s*$/\n/;
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
------------------------------
Date: Sat, 15 Jul 2000 10:16:41 +0200
From: "Brendon Caligari" <bcaligari@shipreg.com>
Subject: Re: local and use strict
Message-Id: <8kp61m$cs3$1@news.news-service.com>
"jason" <elephant@squirrelgroup.com> wrote in message
news:MPG.13da5ed557c176009896b9@news...
> Brendon Caligari wrote ..
> ><nobull@mail.com> wrote in message
news:u9itu8u19l.fsf@wcl-l.bham.ac.uk...
> >
> >> However, in general you should avoid doing this. local() is a powerfull
> >> tool in the cases where it is the right tool. It is however not often
> >> the right tool.
> >
> >I admit that while I appreciate it's existence, I couldn't really
conceive
> >any particular use for it. I classify it together with taboos like
'gotos'.
>
> you just haven't come across a situation that it was made for yet - or
> don't understand Perl's special variables .. the following situation is
> perfect for local to be used
>
> my @input = ();
> open INPUT, "blah" or die "etc";
> {
> local $/;
> @input = <INPUT>;
> }
>
> # continue program
>
> >I'm still trying to 'accept' previousy frowned upon concepts such
> >as breaking straight out of a number of nested loops
>
> frowned upon by whom ? .. breaking out of a loop is a well tested and
> supported language feature than lends itself to good design
I'm just intrdocuing myself to perl. Many perl concepts are 'NO NO NO' in
other 'stricter' languages. Try 'breaking' out of two nested loops in C.
Perl can get a bit confusing, to guys like me who are coming from a
programming
but un-perlish background. As time goes by I am really turning to perl, at
least for the everyday tasks (hardly turn to C / awk any more. nothing
beats
grep / sed / csh for the majority of quickies in sysadmin though) but I
honestly cannot see Perl as a language fit for...say..students who are still
at their programming-concepts infancy.
>
> >> Note that "for", "map" and "grep" implicity localise $_, you don't
> >> need to do it explicitly.
> >
> >Aha. So, really and truly it's irrelevant what gets passed to, say,
> >a foreach iteration in fact being 'localised'.
> >
[ cut ]
>
> from a linguistic view - there's nothing wrong with the above .. from a
> human understanding view - it's rarely advantageous to use the one
> variable for two different purposes .. the above would be better written
> as
sorry I confused you there......that was just an 'experiment'
to check $s's contents before and after being used within
a foreach :-)
>
[ cut ]
>
Thanks
Brendon
------------------------------
Date: Sat, 15 Jul 2000 11:07:48 GMT
From: martin@radiok2r.de
Subject: Locking a file
Message-Id: <8kpgm0$1ju$1@nnrp1.deja.com>
Hi !
What's the best way to lock/unlock a file while one user is working with
ist ? I could use flock(), but if the user aborts or the connections
breaks down, the file would be locked forever...
Regards
Martin
P.S.: Please mail your answers, too, to martin@radiok2r.de Thanx.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sat, 15 Jul 2000 05:16:34 -0400
From: "Stuart Horner" <stuart@unidev.com>
Subject: Perl can't add !
Message-Id: <NUVb5.16320$EQ3.572715@news-east.usenetserver.com>
I'm having a Perl adding error!
Here is the code:
foreach $key (@Sorted)
{
print "\"$InitialAmount\" + \"$SearchResults{$key}{'Amount'}\" = ";
$InitialAmount = $SearchResults{$key}{'Amount'} + $InitialAmount;
print "\"$InitialAmount\"\n";
}
Here is a snippit of the output:
"823.35" + "24.95" = "848.3"
"848.3" + "24.95" = "873.25"
"873.25" + "24.95" = "898.200000000001"
"898.200000000001" + "24.95" = "923.150000000001"
"923.150000000001" + "24.95" = "948.100000000001"
"948.100000000001" + "24.95" = "973.050000000001"
"973.050000000001" + "24.95" = "998.000000000001"
"998.000000000001" + "24.95" = "1022.95"
"1022.95" + "24.95" = "1047.9"
"1047.9" + "24.95" = "1072.85"
"1072.85" + "24.95" = "1097.8"
"1097.8" + "24.95" = "1122.75"
"1122.75" + "24.95" = "1147.7"
<snip>
"2999.15" + "24.95" = "3024.1"
"3024.1" + "24.95" = "3049.05"
"3049.05" + "24.95" = "3074"
"3074" + "24.95" = "3098.95"
"3098.95" + "24.95" = "3123.9"
"3123.9" + "24.95" = "3148.84999999999"
"3148.84999999999" + "64.95" = "3213.79999999999"
"3213.79999999999" + "24.95" = "3238.74999999999"
"3238.74999999999" + "24.95" = "3263.69999999999"
"3263.69999999999" + "24.95" = "3288.64999999999"
"3288.64999999999" + "2.95" = "3291.59999999999"
"3291.59999999999" + "24.95" = "3316.54999999999"
"3316.54999999999" + "24.95" = "3341.49999999999"
"3341.49999999999" + "2.95" = "3344.44999999999"
"3344.44999999999" + "24.95" = "3369.39999999999"
"3369.39999999999" + "2.95" = "3372.34999999999"
What is going on with this?? I'm just adding two numbers together, from a
hash of a hash!
I've had this problem on two different machines running two different
operating systems, on two different versions of Perl.
Sun OS 7 Perl 5.003 and RedHat 6.1 (I don't know the kernal version) Perl
5.6
All the printing is only to show the results at each step for debugging.
(i.e. finding out where the heck that .000000000001 is coming from).
Any responses appreciated!!
Regards,
Stuart Horner
stuart@NOSPAMPLEASE.core-comm.com
Please remove the nospamplease. to e-mail.
------------------------------
Date: Sat, 15 Jul 2000 13:05:47 +0200
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Perl can't add !
Message-Id: <f4h0nssdonf12tjbm440qutrom1buvgh71@4ax.com>
Stuart Horner wrote:
>Here is a snippit of the output:
What exactly is your problem? The sums I've looked at, seem to give the
proper sum.
If it's the large number of digits after the decimal point, that's an
artifact of the fact that numbers are represented in floating point,
i.e. approximations for non-integers that aren't representable as an
integer divided by a power of two. It happens in ANY language using
Floating Point. It's a FAQ, see perlfaq4:
Why am I getting long decimals (eg, 19.9499999999999) instead of the
numbers I should be getting (eg, 19.95)?
--
Bart.
------------------------------
Date: Sat, 15 Jul 2000 09:48:43 +0200
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Perl Rocks!(OT?)
Message-Id: <ml50nskufvl36poagam46ue5far9h0raa6@4ax.com>
Rage Matrix wrote:
>I don't see much
>point in using it on a non-UNIX based machine, but the language integrated
>so well with Linux and I LOVE it!
Oh but there is enough reason for using it on non-Unixy systems as well.
For example, Perl is an excellent for massaging database data into an
export, suitable for publication; stuff usually known as "report" inside
a database, but pretty much absent if the "report" is to be published
using external programs.
A simple example is publishing on the Web.
--
Bart.
------------------------------
Date: Sat, 15 Jul 2000 11:43:37 GMT
From: James Mauldin <mauldin@netstorm.net>
Subject: Re: Perl Rocks!(OT?)
Message-Id: <39704DB6.78DD5981@netstorm.net>
Rage Matrix wrote:
> I don't see much point in using it on a non-UNIX based machine
I use Perl under Windows. Last year I wrote a script that does descriptive
statistics on a salary database with > 30,000 observations and outputs the
results to printer, html, and excel. It used to take the client 50 day
person-days to get this done using SPSS (after database scrub); now it takes a
couple of hours (printer bottleneck!). And not using any tricks, either, just
basic Perl.
-- Jim
------------------------------
Date: 15 Jul 2000 07:11:10 GMT
From: doom@kzsu.stanford.edu (Joe Brenner)
Subject: Re: Problems running the perl debugger
Message-Id: <8kp2qe$q9e$1@nntp.Stanford.EDU>
mjtg@cus.cam.ac.uk (M.J.T. Guy) writes:
>Joe Brenner <doom@kzsu.stanford.edu> wrote:
>>
>>Thanks, though maybe I didn't make it clear that I can run
>>run the script under the debugger with a
>>
>> perl -d script.pl
>>
>>without any trouble, the (main) problem is that the debugger won't
>>run at all if the first line of the script tries to turn on
>>taint mode (with the -T flag). I was also having some odd
>>problems running the debugger from under emacs, but that
>>seems to come and go.
>Whenever you get an error from Perl which you don't understand
>(or even if you think you do understand), look it up in perldiag.
>In this case, you'd have found
> Too late for "-T" option
> (X) The #! line (or local equivalent) in a Perl script
> contains the -T option, but Perl was not invoked with -T
> in its command line. This is an error because, by the
> time Perl discovers a -T in a script, it's too late to
> properly taint everything from the environment. So Perl
> gives up.
> If the Perl script is being executed as a command using
> the #! mechanism (or its local equivalent), this error
> can usually be fixed by editing the #! line so that the
> -T option is a part of Perl's first argument: e.g.
> change `perl -n -T' to `perl -T -n'.
> If the Perl script is being executed as `perl
> scriptname', then the -T option must appear on the
> command line: `perl -T scriptname'.
>
>
>which explains what is going on, and what to do about it.
I'm pretty sure that I read this, I just didn't catch the
hint that
perl -dT scriptname
might work... and it does indeed work, I'll give you that
much.
However, it doesn't do me any good when I try it inside of
emacs. If I do a:
M-x perldb
It responds something like this:
Run perldb (like this): perl -X scriptname
And no matter what values of -X I edit into place
(-dT, -Td, -dTw, -dwT, -Tdw, etc.) it still dies.
Evidentally it gets confused and starts running the
debugger on itself (e.g. I see errors like this:
DB<1> Insecure dependency in eval while running with -T
switch at /usr/lib/perl5/5.00503/perl5db.pl
So I'm back to editing the pound bang line before running
perldb...
(There's really no comparison to running the debugger on the
command line and inside of emacs. Inside emacs the display
splits into two tiled subwindows: as you step through the
code in the debugger window, a superimposed pointer moves
through the code buffer in the other emacs window. You
never lose the context, and there's no need to mess with
things like the "w" command. This is the stuff of which
emacs fanatics are made... )
------------------------------
Date: Sat, 15 Jul 2000 10:23:45 +0200
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: The newbie question
Message-Id: <1260ns8994e2vsrtl146chjk2pnnse07um@4ax.com>
Godzilla! wrote:
>What you can construe is I am saying making blanket
>admonitions Perl programmers should always use pragma
>hints, always use strict, is very poor advice, actually
>advice which does guarantee script failure, at times. At
>very best, pragma hints will mislead a progammer into
>making script changes which worsen problems or curtail
>creativity.
Examples?
One example tat I can come up with is the "word frequency count"
snippet:
while(<>) {
while(/(\w+)/) {
$count{$1}++;
}
}
It works without warnings, but that is only because its origin is in
dark times, before common use of -w, so the implementors worked their
way around any warnings which ordinarily ought to have appeared.
It's true, if warnings were really pedantic, in cases like this, too,
then this typical Perlish snippet would never have seen the light of
day.
--
Bart.
------------------------------
Date: Sat, 15 Jul 2000 03:56:34 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: The newbie question
Message-Id: <39704362.426B47B1@stomp.stomp.tokyo>
Bart Lateur wrote:
> Godzilla! wrote:
> >What you can construe is I am saying making blanket
> >admonitions Perl programmers should always use pragma
> >hints, always use strict, is very poor advice, actually
> >advice which does guarantee script failure, at times. At
> >very best, pragma hints will mislead a progammer into
> >making script changes which worsen problems or curtail
> >creativity.
> Examples?
> One example tat I can come up with is the "word frequency count"
> snippet:
>
> while(<>) {
> while(/(\w+)/) {
> $count{$1}++;
> }
> }
> It works without warnings, but that is only because its origin is in
> dark times, before common use of -w, so the implementors worked their
> way around any warnings which ordinarily ought to have appeared.
> It's true, if warnings were really pedantic, in cases like this, too,
> then this typical Perlish snippet would never have seen the light of
> day.
An earmark of a really good programmer is knowledge of when to
use selected tools and when not to use those tools. Another
earmark of good programming techniques is displayed by an
ability to bend or break rules in very positive productive
ways, most often to get a job done despite imposed constraints.
You boys like to play snippet golf which I do actually support
as it enhances techniques in Perl programming; it's creative
and does benefit all paying attention. However, being a rebel
at heart, snippet golf is not my game. My sport is to work at
bending and breaking rules of programming in as many ways as
possible, most often in very verbose ways. Suppose you could
say I play anti-snippet golf; just the reverse of what you
boys like to play. You have much better luck and better
scores however, than myself. Breaking rules is not easy.
It is a sport of searching for exploitable bugs and holes,
a sport of making Perl core think differently.
A problem arises with exploiting holes in Perl. Exploitation
is double edge sword and cuts twofold; beneficial and, quite
destructive if misused. For this reason, there are many topics
which should not be discussed publically, much to my annoyance.
Nonetheless, this is reality and there is a need to keep in
mind not all who participate in this group have good ethics.
Silence on some matters is prudent.
I have a long time, years long nemesis here. Pretty sure
this is becoming quite in evidence. This unpleasant yet
sometimes entertaining rivalry came about by invitation,
an invitation to 'crash test' a chat script, long ago.
No matter what this programmer did, I always found away
around his programming and crashed his beta chat. Towards
the end, when he felt most confident, I drew a small but
deadly dagger from my waistband, opting not to use brute
force of my sword. This dagger is a technique I developed
which actually reformats Perl core, in rather comical ways,
via a standard html form action. Unfortunately, my dagger
seems to have pierced his ego deeply as well. What I made
his beta chat do, although hilarious, he failed to take
notice of the humor. Suppose this might have to do with
a need to reset his entire server to clear what I did.
Goodness, the stories I could tell, such comedy. I do
zing him every so often, even now. Suppose I have earned
this chihuahua trouble nipping at my heels, daily.
May seem I am venturing away from your topic, Mr. Lateur,
which is true. Nevertheless, what I have exemplified and,
your thoughts have exemplified, venturing away from our
standardized techniques, programming in ways we are told
not to do, bending and breaking rules, is of benefit when
done so with good intent. It's a White Hat - Black Hat
Ying and Yang kinda thing. All depends if you are Flash
Gordon or Emperor Ming.
For this thread and in my case, by playing a different
game, anti-snippet golf, by bending and breaking rules,
I have learned how to write programs which experts would
glance over and pronounce fatally non-operative, least till
one of these experts visits with my androids and thinks,
"This friggin program actually works. Well I'll be."
In closing I will emphasize again an important point.
Staying within the rules, using standard methods, is
vitally important and should be practiced consistently.
It is equally important to not be pedantic, as you have
suggested. Pragmas and all that should be suggested very
often but not presented as absolute 'must do' rules. We
are also charged with being responsible in suggesting,
"Have you tried breaking some rules to solve your problem?"
Nice series of articles, Mr. Lateur and, yes, I agree
your code snippet related to the original topic of
this thread, is the best posted. Your solution is
a complex yet short one liner. My solution is about
as simple as the country girl I am truly. Each of
us have posted something unique, something different,
as a result of thinking differently than the norm.
Godzilla!
------------------------------
Date: Sat, 15 Jul 2000 04:18:15 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: The newbie question
Message-Id: <39704877.4253897B@stomp.stomp.tokyo>
"Godzilla!" wrote:
> Bart Lateur wrote:
> > Godzilla! wrote:
(snipped)
> Nice series of articles, Mr. Lateur and, yes, I agree
> your code snippet related to the original topic of
> this thread, is the best posted. Your solution is
> a complex yet short one liner. My solution is about
> as simple as the country girl I am truly. Each of
> us have posted something unique, something different,
> as a result of thinking differently than the norm.
Strike that, wrong thread. =)
This bit of code of yours:
$output = join '', map { sprintf "%02d", $_ } split /\./, $input;
It's the Zero Mostel thingy...
Godzilla!
------------------------------
Date: Sat, 15 Jul 2000 12:40:48 GMT
From: "steve" <SCook@pobox.com>
Subject: Threading and ActiveState Perl 616 on Win32
Message-Id: <kZYb5.2300$4p3.17259@news-server.bigpond.net.au>
Hi,
I am trying to get the code from the Perl threading tutorial to run under
win32 with active perl. No matter what I do it will not work. The
thread.pm module has been included with active perl but it appears to be
broken. Yet reading their release notes it indicates that fork and
threading now are supported on all platforms. Is this wrong?? or is there
some magic that will get active perl on win32 to thread?
Regards,
Steve
------------------------------
Date: Sat, 15 Jul 2000 10:58:59 GMT
From: martho@my-deja.com
Subject: Time in mili-seconds
Message-Id: <8kpg5g$191$1@nnrp1.deja.com>
Hello !
How can I get a timestamp in miliseconds ? "time" returns only seconds.
Regards
Martin
Please mail your answer, too, to: martin@radiok2r.de. Thanx !
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sat, 15 Jul 2000 09:34:41 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: Trying to use an array as a hash value
Message-Id: <39712e94.34693580@news.newsguy.com>
doglovers@rocketmail.com wrote:
>$arrayref = \(a,b,c,d), then you put the reference into the the hash:
You need to reread the documentation on references. The \
distributes over the list, so you get a list of scalar
references, not an array reference. To use \ here you would
need to assign to an array variable first.
@array = qw( a b c d );
$arrayref = \@array;
>Message => $arrayref,
>
>which you then dereference with @$arrayref when
>you need it. Or you can put in an anonymous array with:
>
>Message => [a,b,c,d]
That's the better way to do it.
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
------------------------------
Date: Sat, 15 Jul 2000 13:21:43 +0200
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Trying to use an array as a hash value
Message-Id: <smh0ns4e800b80k1tjvoca0anms0rtmmnt@4ax.com>
doglovers@rocketmail.com wrote:
>So if you create the reference to an array:
>$arrayref = \(a,b,c,d), then you put the reference into the the hash:
That's not an array ref, because the thing on the right side is not an
array. It's just a set of individual items, stored somewhere in
temporary memory. The common Perl term is a "list". You cannot possibly
get a reference to an array that doesn't exist.
So, Perl does something completely different instead: it turns "\(...)"
into a list of individual references to each item. It's not too useful,
I've never seen a program that actually does anything with it. But this
comes close:
sub test {
my $ref = \(shift); # reference to first parameter
$$ref = "oopsadaisie!"; # modifies first parameter
}
my $item;
test($item);
print "$item\n";
p.s. it's in the docs, I'm sure. I just don't remember exactly where...
--
Bart.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 3677
**************************************