[9013] in Perl-Users-Digest
Perl-Users Digest, Issue: 2631 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 18 16:08:27 1998
Date: Mon, 18 May 98 13:01:42 -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 Mon, 18 May 1998 Volume: 8 Number: 2631
Today's topics:
Statistics for comp.lang.perl.misc <gbacon@cs.uah.edu>
testing for empty array element (Rob Warmowski)
Re: testing for empty array element (Mark-Jason Dominus)
Re: testing for empty array element <jdf@pobox.com>
Re: testing for empty array element (Mike Stok)
Re: Timing a script (Craig Berry)
Re: uniq in perl <merlyn@stonehenge.com>
Re: What does a bitwise do? <aqumsieh@matrox.com>
Re: while, each & assoc array <merlyn@stonehenge.com>
Re: Why does Glob change caption in Win32 console windo (Jeffrey R. Drumm)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 18 May 1998 18:28:42 GMT
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: Statistics for comp.lang.perl.misc
Message-Id: <6jpukq$4v3$1@info.uah.edu>
Following is a summary of articles spanning a 7 day period,
beginning at 11 May 1998 14:50:09 GMT and ending at
18 May 1998 15:03:24 GMT.
Notes
=====
- A line in the body of a post is considered to be original if it
does *not* match the regular expression /^\s{0,3}(?:>|:|\S+>|\+\+)/.
- All text after the last cut line (/^-- $/) in the body is
considered to be the author's signature.
- The scanner prefers the Reply-To: header over the From: header
in determining the "real" e-mail address and name.
- Original Content Rating (OCR) is the ratio of the original content
volume to the total body volume.
- Find the News-Scan distribution on the CPAN!
<URL:http://www.perl.com/CPAN/modules/by-module/News/>
- Please send all comments to Greg Bacon <gbacon@cs.uah.edu>.
- Copyright (c) 1998 Greg Bacon. All Rights Reserved.
Verbatim copying and redistribution is permitted without royalty;
alteration is not permitted. Redistribution and/or use for any
commercial purpose is prohibited.
Excluded Posters
================
perlfaq-suggestions\@mox\.perl\.com
Totals
======
Posters: 516
Articles: 1654 (752 with cutlined signatures)
Threads: 433
Volume generated: 2960.6 kb
- headers: 1189.0 kb (23,344 lines)
- bodies: 1633.9 kb (48,279 lines)
- original: 1130.7 kb (36,254 lines)
- signatures: 136.1 kb (2,624 lines)
Original Content Rating: 0.692
Averages
========
Posts per poster: 3.2
median: 1.0 post
mode: 1 post - 336 posters
s: 8.2 posts
Posts per thread: 3.8
median: 2 posts
mode: 1 post - 145 threads
s: 14.3 posts
Message size: 1832.9 bytes
- header: 736.1 bytes (14.1 lines)
- body: 1011.5 bytes (29.2 lines)
- original: 700.0 bytes (21.9 lines)
- signature: 84.3 bytes (1.6 lines)
Top 10 Posters by Number of Posts
=================================
(kb) (kb) (kb) (kb)
Posts Volume ( hdr/ body/ orig) Address
----- -------------------------- -------
105 237.9 ( 87.3/138.0/121.1) tchrist@mox.perl.com (Tom Christiansen)
88 121.5 ( 71.8/ 39.5/ 25.3) Tom Phoenix <rootbeer@teleport.com>
56 100.3 ( 39.0/ 49.6/ 33.9) mgjv@comdyn.com.au (Martien Verbruggen)
41 99.9 ( 26.8/ 66.6/ 38.0) Greg Bacon <gbacon@cs.uah.edu>
40 74.3 ( 35.2/ 29.7/ 18.3) comdog@computerdog.com (brian d foy)
37 54.2 ( 25.9/ 18.3/ 10.0) chip@mail.atlantic.net (Chip Salzenberg)
31 53.7 ( 21.6/ 32.0/ 18.0) ilya@math.ohio-state.edu (Ilya Zakharevich)
27 42.1 ( 18.2/ 23.9/ 15.5) jdporter@min.net (John Porter)
26 44.2 ( 17.0/ 27.1/ 18.5) cberry@cinenet.net (Craig Berry)
25 51.1 ( 19.4/ 25.2/ 17.4) tina@tech.scandinaviaonline.se
These posters accounted for 28.8% of all articles.
Top 10 Posters by Volume
========================
(kb) (kb) (kb) (kb)
Volume ( hdr/ body/ orig) Posts Address
-------------------------- ----- -------
237.9 ( 87.3/138.0/121.1) 105 tchrist@mox.perl.com (Tom Christiansen)
121.5 ( 71.8/ 39.5/ 25.3) 88 Tom Phoenix <rootbeer@teleport.com>
100.3 ( 39.0/ 49.6/ 33.9) 56 mgjv@comdyn.com.au (Martien Verbruggen)
99.9 ( 26.8/ 66.6/ 38.0) 41 Greg Bacon <gbacon@cs.uah.edu>
74.3 ( 35.2/ 29.7/ 18.3) 40 comdog@computerdog.com (brian d foy)
66.7 ( 13.2/ 53.5/ 26.2) 18 fsg@ultranet.com
58.1 ( 20.9/ 36.6/ 29.2) 24 bill@astro.fccj.cc.fl.us
54.2 ( 25.9/ 18.3/ 10.0) 37 chip@mail.atlantic.net (Chip Salzenberg)
53.7 ( 21.6/ 32.0/ 18.0) 31 ilya@math.ohio-state.edu (Ilya Zakharevich)
53.0 ( 7.9/ 42.1/ 24.7) 12 Lloyd Zusman <ljz@asfast.com>
These posters accounted for 31.1% of the total volume.
Top 10 Posters by OCR (minimum of five posts)
==============================================
(kb) (kb)
OCR orig / body Posts Address
----- -------------- ----- -------
1.000 ( 12.7 / 12.7) 9 Jari Aalto <jari.aalto@poboxes.com> (Jari Aalto+usenet.nil)
1.000 ( 7.0 / 7.0) 6 nord@aol.com
1.000 ( 2.1 / 2.1) 5 perlguy@technologist.com
0.985 ( 7.5 / 7.6) 9 fl_aggie@thepentagon.com (I R A Aggie)
0.982 ( 15.3 / 15.6) 15 gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
0.966 ( 6.2 / 6.4) 8 "Allan M. Due" <due@murray.fordham.edu>
0.922 ( 18.2 / 19.8) 9 Nathan Torkington <gnat@frii.com>
0.887 ( 21.0 / 23.7) 14 mjd@op.net (Mark-Jason Dominus)
0.877 (121.1 /138.0) 105 tchrist@mox.perl.com (Tom Christiansen)
0.877 ( 1.4 / 1.6) 5 "kll" <kliou@ichat.com>
Bottom 10 Posters by OCR (minimum of five posts)
=================================================
(kb) (kb)
OCR orig / body Posts Address
----- -------------- ----- -------
0.500 ( 3.9 / 7.8) 9 arch@abts.net
0.499 ( 9.6 / 19.3) 16 abigail@fnx.com
0.491 ( 2.1 / 4.4) 8 kpreid@ibm.net (Kevin Reid)
0.491 ( 26.2 / 53.5) 18 fsg@ultranet.com
0.469 ( 2.9 / 6.3) 5 les@MCS.COM (Leslie Mikesell)
0.448 ( 2.9 / 6.5) 8 Yong Huang <yong@shell.com>
0.428 ( 4.2 / 9.9) 10 phenix@interpath.com (John Moreno)
0.421 ( 6.3 / 14.9) 8 mwmaurer@mtu.edu (Mark Maurer)
0.404 ( 3.2 / 8.0) 9 keithmur@mindspring.com
0.356 ( 1.9 / 5.3) 10 Bob Trieger <sowmaster@juicepigs.com>
Top 10 Threads by Number of Posts
=================================
Posts Subject
----- -------
286 Does Perl have a IDE?I don't like command line.
54 How can you break out of a 'while... ' loop in a function?
35 Significant digit?
32 Is if ($a="something") a bad style?
18 Randomly sorting an array
17 Tip: Filehandles
17 Nuclear bombing of NEW YORK! Small countries can target with nukes!
16 MODULE MANIA STRIKES (Was Re: What does this do?)
16 Perl for Non-programmers (was Re: Does Perl have a IDE?I don't like command line.
16 Grieving our dying community
These threads accounted for 30.7% of all articles.
Top 10 Threads by Volume
========================
(kb) (kb) (kb) (kb)
Volume ( hdr/ body/ orig) Posts Subject
-------------------------- ----- -------
661.6 (224.3/407.9/249.3) 286 Does Perl have a IDE?I don't like command line.
160.3 ( 44.1/110.9/ 93.7) 54 How can you break out of a 'while... ' loop in a function?
65.1 ( 27.6/ 34.1/ 20.6) 35 Significant digit?
49.9 ( 22.6/ 24.2/ 15.4) 32 Is if ($a="something") a bad style?
35.9 ( 12.7/ 21.6/ 13.5) 16 Grieving our dying community
35.2 ( 12.8/ 19.6/ 12.6) 16 MODULE MANIA STRIKES (Was Re: What does this do?)
32.8 ( 13.9/ 17.7/ 12.1) 17 Tip: Filehandles
30.7 ( 13.1/ 15.8/ 10.8) 16 Perl for Non-programmers (was Re: Does Perl have a IDE?I don't like command line.
30.6 ( 8.4/ 20.5/ 16.9) 11 form data
29.0 ( 14.5/ 11.5/ 7.8) 18 Randomly sorting an array
These threads accounted for 38.2% of the total volume.
Top 10 Threads by OCR (minimum of five posts)
==============================================
(kb) (kb)
OCR orig / body Posts Subject
----- -------------- ----- -------
0.891 ( 8.1/ 9.1) 7 ANNOUNCE: Bit::Vector 5.3
0.845 ( 93.7/ 110.9) 54 How can you break out of a 'while... ' loop in a function?
0.842 ( 1.7/ 2.0) 6 Get file date
0.841 ( 6.8/ 8.0) 8 How to generate random passwords?
0.838 ( 4.6/ 5.4) 5 bug in win95 read/sysread?
0.822 ( 16.9/ 20.5) 11 form data
0.804 ( 4.9/ 6.0) 5 writing simple XS functions
0.803 ( 1.9/ 2.3) 5 @array(@range) possible??
0.790 ( 3.1/ 3.9) 5 why does "my($MyTime) = localtime;" act differently that "my $MyTime = localtime;" ?
0.782 ( 3.0/ 3.9) 7 localtime function and Y2K compliance
Bottom 10 Threads by OCR (minimum of five posts)
=================================================
(kb) (kb)
OCR orig / body Posts Subject
----- -------------- ----- -------
0.569 ( 5.9 / 10.4) 13 New IDE for Perl
0.544 ( 1.8 / 3.3) 5 Basic MacPERL
0.535 ( 3.8 / 7.2) 8 Installing PERL on NT
0.531 ( 3.0 / 5.7) 7 perl text editor for windows95
0.528 ( 1.7 / 3.2) 5 Need Perl command to pull HTML from a remote site. (HTTPGET)??
0.515 ( 2.5 / 4.8) 8 removing last line from file
0.471 ( 2.4 / 5.1) 6 a header for `Mail me copies' or `Do not mail me copies'
0.459 ( 1.1 / 2.4) 5 sourcing a file in Perl
0.458 ( 3.3 / 7.2) 9 Removing ^M at the end of each line of a file.
0.439 ( 3.4 / 7.8) 9 chdir-command
Top 10 Targets for Crossposts
=============================
Articles Newsgroup
-------- ---------
30 comp.lang.perl.modules
16 sci.lang.translation
16 sci.lang
16 alt.usage.english
14 news.software.readers
11 comp.lang.c
11 de.comp.lang.perl
9 de.comp.lang.c
8 comp.databases.sybase
8 comp.os.linux.misc
Top 10 Crossposters
===================
Articles Address
-------- -------
21 sb@engelschall.com (Steffen Beyer)
18 nord@aol.com
10 mgjv@comdyn.com.au (Martien Verbruggen)
8 Stephan.Wilms@CWA.de
8 "alehoop!!" <chat@web.com>
6 "H. Meyer" <Heino.Meyer@pcm.bosch.de.offspam>
6 Andy Glew <glew@cs.wisc.edu>
5 "Martin Ambuhl" <mambuhl@tiac.net>
5 hamjavar@unm.edu (Farid Hamjavar)
4 txema@thepentagon.com
------------------------------
Date: 18 May 1998 18:03:20 GMT
From: rob@xochi.tezcat.com (Rob Warmowski)
Subject: testing for empty array element
Message-Id: <6jpt58$3hf$1@tepe.tezcat.com>
Hi:
Non-programmer question. Read the FAQ, used the camel. Still stuck.
If I load the array @fields like this
@fields = split(/x/,$_);
resulting in 4 elements
and I test $fields[2] to be empty like so:
$foo = $fields[2]
foreach @read_line {
next if $foo = '';
do some crap
next;
}
...and the debugger says, right after @fields is loaded up
x $foo
$foo = ' '
but the next if is never executed...
What am I doing wrong here? $foo is not undef. It's empty, no?
Ver: 5.003 Win32
Thanks very much in advance for any time and help,
-r
--
--
>From the [x] desk [ ] palm of Rob Warmowski
rob@tezcat.com
------------------------------
Date: 18 May 1998 14:16:24 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: testing for empty array element
Message-Id: <6jptto$c5r$1@monet.op.net>
In article <6jpt58$3hf$1@tepe.tezcat.com>,
Rob Warmowski <rob@tezcat.net> wrote:
>next if $foo = '';
>but the next if is never executed...
That is an assignment. The string comparison operator is `eq'.
------------------------------
Date: 18 May 1998 15:09:08 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: testing for empty array element
Message-Id: <hg2nz6hn.fsf@mailhost.panix.com>
rob@xochi.tezcat.com (Rob Warmowski) writes:
> Non-programmer question. Read the FAQ, used the camel. Still
> stuck.
You cannot use Perl and be a non-programmer. That's a
self-contradiction. You may not be an experienced programmer, but
you're programming.
> If I load the array @fields like this
>
> @fields = split(/x/,$_);
You may omit $_:
@fields = split /x/;
> next if $foo = '';
Oops. You've just assigned the null string to $foo. Therefore, that
expression is false. Therefore, that "next" will never happen.
String comparison is done with the eq operator:
next if $foo eq '';
Or, you may say
next unless $foo;
But if $foo is empty, then you might as well skip the entire loop,
rather than "next if..." since $foo never will change under those
circumstances, judging from the code you posted. Is that a bug?
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf/
------------------------------
Date: 18 May 1998 19:31:50 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: testing for empty array element
Message-Id: <6jq2b6$oo2@news-central.tiac.net>
In article <hg2nz6hn.fsf@mailhost.panix.com>,
Jonathan Feinberg <jdf@pobox.com> wrote:
>> next if $foo = '';
>
>Oops. You've just assigned the null string to $foo. Therefore, that
>expression is false. Therefore, that "next" will never happen.
>String comparison is done with the eq operator:
>
> next if $foo eq '';
>
>Or, you may say
>
> next unless $foo;
There is a difference between next if $foo eq '' and next unless $foo in
the case when $foo contains the single character string '0'. This might
not matter here, but...
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: 18 May 1998 18:36:29 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Timing a script
Message-Id: <6jpv3d$otu$3@marina.cinenet.net>
Andrew Hearn (andrew@ctec.org.uk) wrote:
: Can any one tell me how I can get the time the script takes to run?
:
: EG. in a search script, the script searches and returns the result with
: the time it took.
The most straightforward way to get an elapsed time in seconds is:
# Near the top of your script:
$t0 = time;
# Bulk of work goes here.
$elapsed = time - $t0;
Note that this only gets you an integer number of seconds, and that the
precision is +- 1 second. So for quick searches on a fast server, it
won't mean much. Also note that user percieved search time can be
noticeably longer due to network delays.
If you need finer resolution, I suggest lifting the hood on Benchmark.pm
and seeing how it handles code timing.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: Mon, 18 May 1998 18:58:54 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
To: Thorbjoern Ravn Andersen <ravn@imada.ou.dk>
Subject: Re: uniq in perl
Message-Id: <8cu36nz9qp.fsf@gadget.cscaper.com>
>>>>> "Thorbjoern" == Thorbjoern Ravn Andersen <ravn@imada.ou.dk> writes:
Thorbjoern> $ cat whatever | perl -ne 'print if (! $seen_before{$_}++)'
If this was comp.unix.*, I would have pointed out the "useless use of cat"
there. But I won't. :-)
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 105 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Mon, 18 May 1998 13:56:02 -0700
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: What does a bitwise do?
Message-Id: <3560A061.428ABEB7@matrox.com>
Allan M. Due wrote:
<snip>
> ``|'' returns its operators ORed together bit by bit.
> Binary ``^'' returns its operators XORed together bit by bit.
>
> Hmm, so I copied a little script :
> $ans = 2 | 1204;
> print ("2 OR 1204 is $ans\n");
>
> and then tried switching the | to ^ and using different numbers. Sadly I
> just can't figure out what these bitwise ors are up to.
The | is ORing your numbers bit by bit :-)
Any number is stored by the computer as a binary sequence of 32 bits. If you
don't know what binary numbers are, then you should grab any book about boolean
algebra or fundamentals of computers engineering .. etc.
As an example, suppose you have
$ans = 10 | 7;
Looking only at the last four bits, 10 (in decimal) = 1010 (in binary) and 7
(in dec) = 0111 (in binary) ..
10|7 means ORs each corresponding pair of bits in the two numbers, giving
1010
0111
-----
1111 (bin) = 15 (dec)
Similarly 10^7 XORs the corresponding bits giving
1010
0111
-----
1101 (bin) = 13 (dec)
Hope that was helpful.
Ala
------------------------------
Date: Mon, 18 May 1998 18:49:27 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: while, each & assoc array
Message-Id: <8c4syn1kjs.fsf@gadget.cscaper.com>
>>>>> "John" == John Moreno <phenix@interpath.com> writes:
John> Yeah, I don't know who should be given the credit for it, but perls
John> alternative for the single statement (statement condition;) is much
John> better.
There's no such thing. It's "expression condition;" You cannot tack a
condition onto an arbitrary statement.
If you read that in a book, please tell me the book, so I can laugh
at it properly. :-)
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 105 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Mon, 18 May 1998 19:18:56 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: Why does Glob change caption in Win32 console window?
Message-Id: <35608678.30038813@news.mmc.org>
[posted and mailed]
On Mon, 18 May 1998 12:31:30 -0500, benbean@yahoo.com (Benjamin Smith) wrote:
>Hi,
Hello.
>I'm using Glob within a Win32 Perl script. The process that it creates
>appears to take over the original console process so that the caption in
>the console window changes to "PERLGLOB".
ActiveState port, I'll bet. It spawns PerlGlob.exe for file globbing.
>Does anybody know how to prevent this?
Two possibilities:
1. Switch to the Sarathy port, which can be found at:
http://www.perl.com/CPAN-local/ports/win32/Standard/x86/perl5.00402-bindist04-bc.zip
2. Don't use glob . . . use opendir/readdir, perhaps filtering with grep to get
just what you're interested in (regexes beat the hell out of DOS wild cards for
flexibility).
If I were you, I'd do both!
>Thanks!
You're welcome.
--
Jeffrey R. Drumm, Systems Integration Specialist
Maine Medical Center - Medical Information Systems Group
drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me
------------------------------
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 2631
**************************************