[12709] in Perl-Users-Digest
Perl-Users Digest, Issue: 118 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 12 11:07:14 1999
Date: Mon, 12 Jul 1999 08:05:07 -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 Mon, 12 Jul 1999 Volume: 9 Number: 118
Today's topics:
Re: Assocative Arrays (Greg Bacon)
Re: Calling C libs from C libs from Perl with XS <tobez@plab.ku.dk>
Re: die or print (Tad McClellan)
Re: FAQ 5.7: How can I use a filehandle indirectly? (Greg Bacon)
Re: Getting very irregular single 'name' field into fir <stephenb@scribendum.win-uk.net>
Re: Getting very irregular single 'name' field into fir (Tad McClellan)
Re: Getting very irregular single 'name' field into fir (Greg Bacon)
Re: grep with empty list (Bart Lateur)
Re: How do you get rid of a remainder in a number (Tad McClellan)
Is it just me or....... <chris@inta.net.uk>
Need help : OO Perl <berube@odyssee.net>
Re: Need help : OO Perl (Benjamin Franz)
New posters to comp.lang.perl.misc <gbacon@cs.uah.edu>
Re: Pattern match counting (Greg Bacon)
Perl code finds Perl to be popular! (Was: faster grep?) <jjens@primenet.com>
Re: regex question (Bart Lateur)
Re: regex question <gellyfish@gellyfish.com>
Re: regex question <scott@cablesoft.com>
Re: single instance log file <sskinner@cloud9.net>
Statistics for comp.lang.perl.misc <gbacon@cs.uah.edu>
Unix Perl Script ported to NT problem <webmaster@ieo.com>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 12 Jul 1999 14:52:37 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Assocative Arrays
Message-Id: <7mcvfl$rp$4@info2.uah.edu>
In article <us2d7y17zld.fsf@fri2007.fm.intel.com>,
Michael Kelly - FVC PCD VET ~ <kelly@pcocd2.intel.com> writes:
: Why does everyone want to talk trash about my favorite data
: structure? I see people trying to sort from indexed lists, and a
: HoHoH... is much better.
my %HoH = { a => { foo => 'bar' } };
$h->{PARENT} = \%HoH; # your mom's a HoH! :-)
Greg
--
When Galileo turned his telescope toward the heavens, and allowed Kepler to
look as well, they found no enchantment or authorization in the stars, only
geometric patterns and equations. God, it seemed, was less of a moral
philosopher than a master mathematician. -- Neil Postman
------------------------------
Date: Mon, 12 Jul 1999 15:59:56 +0200
From: Anton Berezin <tobez@plab.ku.dk>
Subject: Re: Calling C libs from C libs from Perl with XS
Message-Id: <19990712155956.J42941@lion.plab.ku.dk>
On Mon, Jul 12, 1999 at 01:44:26PM +0000, Rob Sweet wrote:
> I have a perl module which calls a library compiled from C.
...
> However, the library itself calls another library, and this is where
> I'm failing.
>
> Imagine that I've written a library named libFOO.a and functions in
> libFOO.a call functions in libBAR.a (note that both libFOO and libBAR
> are by me, not part of the standard distribution).
>
> my.pm -> libFOO.a -> libBAR.a
>
> running make test fails with:
>
> 'Can't load 'blib/.../FOO.so' for module FOO: 'blib/...FOO.so:
> undefine symbol: a_func_in_libBAR at
> /usr/lib/perl5/...../DynaLoader.pm line 169.'
>
> I see that the problem is that I need to either tell it how to find
> libBAR.a at run-time, or else how to link it in at compile time... but
You can't load .a at run time.
> I expect the answer will be RTF-perldocs of some sort, which is ok
You guessed right. :-) See either extra_libraries parameter in h2xs
manpage (you *are* using h2xs, aren't you?), or the LIBS attribute for
WriteMakefile() in ExtUtils::MakeMaker manpage.
Hope this helps,
--
Anton Berezin <tobez@plab.ku.dk>
The Protein Laboratory, University of Copenhagen
------------------------------
Date: Mon, 12 Jul 1999 04:44:37 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: die or print
Message-Id: <lt9cm7.g5c.ln@magna.metronet.com>
Tony Greenwood (tony@webscripts.org) wrote:
: However for me if I use || die "blah blah $!"; it does as I expect it
: would, it dies. So I see no results of $!
: So I use || print "blah blah $!"; and can see the results of $!
: I presume "die" is preferable to "print" but produces nothing for me.
I doubt that.
Let's see a small and complete Perl program where die()
"produces nothing".
: My question is, Do I presume correctly ?
print() outputs to STDOUT.
die() outputs to STDERR.
You are probably not looking in the right place to see the die()
output...
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 12 Jul 1999 15:00:01 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: FAQ 5.7: How can I use a filehandle indirectly?
Message-Id: <7mcvth$rp$5@info2.uah.edu>
In article <37886376.57218315@nntp.ix.netcom.com>,
miker3@ix.netcom.com (Michael Rubenstein) writes:
: Ordinary, conversational, English is, I believe, the appropriate
: standard for Usenet discussion.
Itid take me damn near ten minnits fer me t'post in conv'sational
Suth'n. Itid take you 'bout just as long t'read 'em.
Let's stick to Standard English (as opposed to, say, nonstandard
variations like the Queen's English :-) :-) for the English
hierarchies.
Greg
--
Fenster: I had a guy's fingers in my asshole tonight.
Hockney: Is it Friday already?
------------------------------
Date: Mon, 12 Jul 1999 14:28:45 +0100
From: "Stephen Benson" <stephenb@scribendum.win-uk.net>
Subject: Re: Getting very irregular single 'name' field into first/last name for credit card gateway -- what hit rate is possible?
Message-Id: <7mcsmt$67$1@plutonium.compulink.co.uk>
Atcherlly I do snip/arrange the buggers, time allowing, but again, so what?
This meant to be content-driven communication. no? And that last one I felt
should be left complete in all its glory.
Bandwidth -- jeez I don't add html, lil songs and piccies -- an
anachronistic discussion, I feel. What about all the mails that are in there
twice -- html/text? What about this ridiculous exchage?
Basically I don't think anything I've done in my posts deserves this
extended display of (b)anality.
All I wanted was a couple of intelligent comments on a certain question.
What do I get - acres of wasted bandwidth by a couplepeople claiming they're
in favour of saving bandwidth and I have to defend a posting style used by
millions.
And then there's Judge Abigail.... nc.
Guys, do you just reply on these peripheral subjects, crusading to enforce
the One True Posting Style or to save bandwidth while pissing it away?
That is verry much it from me... everyone else, verry sorry for the waste of
space...
> >I've posted for years, whether to put the quoted mail top/bottom is
> >unregulated, and in practice more people do it the way I do, so people
> >instantly see the current message, and scroll down to the old if they
> >need it. Matter of taste.
>
> It's a poor habit, especially since that tends to make you lazy: you do
> not snip the original post, and keep everything that is not important
> for your reply in. That is an enormous waste of bandwidth, as servers
> tend to drop older messages as soon as their disks are full. Your nasty
> little habit makes sure that fewer posts are kept on the servers.
------------------------------
Date: Mon, 12 Jul 1999 04:32:14 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Getting very irregular single 'name' field into first/last name for credit card gateway -- what hit rate is possible?
Message-Id: <e69cm7.g5c.ln@magna.metronet.com>
Stephen Benson (stephenb@scribendum.win-uk.net) wrote:
: I've posted for years, whether to put the quoted mail top/bottom is
^^^^
This is Usenet.
We are discussing Usenet articles, not email.
: unregulated, and in practice more people do it the way I do, so people
: instantly see the current message, and scroll down to the old if they need
: it. Matter of taste.
: Actually 'we'/'you' write here in many languages; and as someone as clearly
: netiquette-literate as should know, this is a debate that comes and goes
: with boring predictability; those of us who have seen it before try not to
: provoke it again.
: As for looking like a fool, nc. Who made you webcop, anyway?
I think he was trying to save you from getting killfiled.
It did not work.
**plonk**
: Abigail <abigail@delanet.com> wrote in message
: news:slrn7oevoj.h7.abigail@alexandra.delanet.com...
: > Stephen Benson (stephenb@scribendum.win-uk.net) wrote on MMCXXXIX
: > September MCMXCIII in <URL:news:7m71oj$nc7$1@plutonium.compulink.co.uk>:
: > [ Out of order quote ]
: >
: > Please, we write here in English, not in a language that reads bottom to
: > top (else we would have to reverse the orders of the lines as well). First
: > putting in your reply, then what you are replying to makes you look like
: > a fool. Television programs don't show the summary of last weeks episode
: > after this weeks episode either, do they?
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 12 Jul 1999 15:04:51 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Getting very irregular single 'name' field into first/last name for credit card gateway -- what hit rate is possible?
Message-Id: <7md06j$rp$6@info2.uah.edu>
In article <7mch3i$c4f$1@plutonium.compulink.co.uk>,
"Stephen Benson" <stephenb@scribendum.win-uk.net> writes:
: As for looking like a fool, nc. Who made you webcop, anyway?
Usenet ne WWW;
Greg
--
If you lie to the compiler, it will get its revenge.
-- Henry Spencer
------------------------------
Date: Mon, 12 Jul 1999 14:25:43 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: grep with empty list
Message-Id: <378df867.10183259@news.skynet.be>
Marcel wrote:
> If you evaluate a named array in a scalar context,
> it returns the length of the array. (Note that this
> is not true of lists, ..., nor of built-in functions,
> which return whatever they feel like returning.)
>
>Does that explain it?
No. It says that a definition of a function may do as it will. So may
your own functions: just check wantarray, and return whatever you like
in either case (true or false).
grep() in scalar context is supposed to return the number of matches.
Even if it got an empty list as arguments, it STILL should do that, i.e.
return zero ("no matches").
I'd call it a bug. Somewhere, internally, grep() make a shortcut, and
that shortcut returns a different result, than the non-shortcut version.
Try this:
$both = grep { $_ < 0 } grep { $_ & 1 } 2,4,6;
print "($both)\n";
This should print out the number of odd numbers in the list (2,4,6) that
are negative: 0. Yet, it prints nothing. Add "7" to the argument list,
and you get "0".
Exchange the two code blocks for grep(). Again, it prints nothing.
It's a bug. You can get around it by adding 0, it even gives no warning.
So it's a boolean false flag.
Bart.
------------------------------
Date: Mon, 12 Jul 1999 04:40:15 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: How do you get rid of a remainder in a number
Message-Id: <fl9cm7.g5c.ln@magna.metronet.com>
Jordan Hiller (hiller@email.com) wrote:
: I'm afraid Abigail can't get over how fun it is to harass newbies or anyone with
: questions. I think I've seen him truly help someone maybe once in the last
: month. Hypocrite too--every message he sends says "read the FAQ", supposedly to
: reduce the noise on this newsgroup, but it's Abigail making all the noise!
: Flame on.
Newsreaders (i.e. programs that were designed from the start to
be used to read news) have a "killfile" feature for weeding out
posts that you find uninteresting.
If you don't like Abigail's postings, make the appropriate
killfile entry.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 12 Jul 1999 15:13:23 +0100
From: "Chris Denman" <chris@inta.net.uk>
Subject: Is it just me or.......
Message-Id: <7mctci$1q68$1@news2.vas-net.net>
Is it just me, or is the split command slow?
I have a script which delivers search results from a database to the web.
The data is stored in a simple way as follows:
file 1.dat contains-
Name:Chris:\n
Address:Whatever:\n
Age:28:\n
file 2.dat contains-
Name:Fred:\n
Address:Bloggs:\n
Age:21:\n
...etc
What I do is open up each record and create an associative array using the
split command. Later I can then access any record by using
$DATA[$loop]{'Name'}. All of the code is fine, but I have pinpointed the
bottleneck to the split command.
There are about 3000 records, and the results take many seconds to appear.
The server is fast, and the files load in fast.
Any comments would be appreciated.
Thanks
Chris Denman
------------------------------
Date: Mon, 12 Jul 1999 10:29:01 -0400
From: "Benjamin Bérubé" <berube@odyssee.net>
Subject: Need help : OO Perl
Message-Id: <7mctao$dmq$1@news.quebectel.com>
hello,
I have read that you can do Object Oriented programming in Perl. It seems
to be some sort of extension from the packages. I read the doc about it
that I found in my copy of perl5, but there isn't any good example to get
you started. Can anyone let me know about a good example/tutorial ?
Else, here is a class example i wrote. It doesn't do much, it's just for
learning. The following is the code for File.pm :
------------------------------------
package File;
$i=0;
sub new
{
my($myref) = [];
bless($myref);
return ($myref);
}
sub add
{
my($object) = shift(@_);
$object->[$i++] = "titi";
}
sub show
{
my($object) = shift(@_);
print "nb:$i\n$object->[0]\n";
}
---------------------------------
okay, now let's say I do the following in the script run.pl :
$a = new File;
$b = new File;
$a->add();
$a->add();
$a->add();
$b->add();
$a->show();
$b->show();
After running the script, I found that the $i value in the File class is not
private to an object. Actually, all objects use the same variable, so when
the method $b->add() is called, it increments the same $i as the $a->add().
How can I create privates variables ? Is it by using bless ?
thanks !
ben
------------------------------
Date: Mon, 12 Jul 1999 14:35:42 GMT
From: snowhare@long-lake.nihongo.org (Benjamin Franz)
Subject: Re: Need help : OO Perl
Message-Id: <23ni3.53$e7.25981@typhoon-sf.snfc21.pbi.net>
In article <7mctao$dmq$1@news.quebectel.com>, Benjamin Bérubé <berube@odyssee.net> wrote:
>
>I have read that you can do Object Oriented programming in Perl. It seems
>to be some sort of extension from the packages. I read the doc about it
>that I found in my copy of perl5, but there isn't any good example to get
>you started. Can anyone let me know about a good example/tutorial ?
'Programming Perl' chapter 5.
perldoc perltoot
--
Benjamin Franz
------------------------------
Date: 12 Jul 1999 14:34:50 GMT
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: New posters to comp.lang.perl.misc
Message-Id: <7mcuea$19n$2@info2.uah.edu>
Following is a summary of articles from new posters spanning a 7 day
period, beginning at 05 Jul 1999 14:16:47 GMT and ending at
12 Jul 1999 07:42:37 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" email 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) 1999 Greg Bacon.
Verbatim copying and redistribution is permitted without royalty;
alteration is not permitted. Redistribution and/or use for any
commercial purpose is prohibited.
Totals
======
Posters: 272 (48.0% of all posters)
Articles: 413 (22.8% of all articles)
Volume generated: 666.1 kb (21.3% of total volume)
- headers: 302.4 kb (6,174 lines)
- bodies: 356.5 kb (11,677 lines)
- original: 249.6 kb (8,709 lines)
- signatures: 6.8 kb (172 lines)
Original Content Rating: 0.700
Averages
========
Posts per poster: 1.5
median: 1.0 post
mode: 1 post - 189 posters
s: 1.2 posts
Message size: 1651.4 bytes
- header: 749.8 bytes (14.9 lines)
- body: 883.9 bytes (28.3 lines)
- original: 618.9 bytes (21.1 lines)
- signature: 16.8 bytes (0.4 lines)
Top 10 Posters by Number of Posts
=================================
(kb) (kb) (kb) (kb)
Posts Volume ( hdr/ body/ orig) Address
----- -------------------------- -------
10 15.1 ( 6.8/ 8.0/ 6.3) elaine ashton <elaine@chaos.wustl.edu>
6 12.5 ( 4.7/ 7.8/ 3.6) Tom Mornini <tmornini@netcom9.netcom.com>
5 8.6 ( 4.4/ 3.7/ 1.5) Per Kistler <kistler@fnmail.com>
5 6.8 ( 4.8/ 2.0/ 0.9) Matt Sergeant <matt@sergeant.org>
5 8.0 ( 3.3/ 4.7/ 4.1) "Paul Glidden" <paul.glidden@unisys.com>
5 8.6 ( 3.8/ 4.8/ 3.6) Ian Mortimer <ianmorty@nortelnetworks.com>
4 8.6 ( 3.1/ 5.5/ 3.4) "Dude Man" <dudeman@dude.com>
4 5.0 ( 2.9/ 2.1/ 1.7) "Brendan Reville" <breville@mpce.mq.edu.au>
4 5.6 ( 2.8/ 2.1/ 1.8) davidq@NOSPAMpost.almac.co.uk (David Quinton)
4 5.3 ( 2.7/ 2.6/ 1.1) Marshall Culpepper <marshalc@americasm01.nt.com>
These posters accounted for 2.9% of all articles.
Top 10 Posters by Volume
========================
(kb) (kb) (kb) (kb)
Volume ( hdr/ body/ orig) Posts Address
-------------------------- ----- -------
15.1 ( 6.8/ 8.0/ 6.3) 10 elaine ashton <elaine@chaos.wustl.edu>
13.4 ( 1.4/ 12.0/ 6.2) 2 Pierre-Michel Ansel <pierre-michel.ansel@steria.fr>
13.3 ( 0.9/ 12.2/ 11.0) 1 kaih=7Kg9z571w-B@khms.westfalen.de (Kai Henningsen)
12.5 ( 4.7/ 7.8/ 3.6) 6 Tom Mornini <tmornini@netcom9.netcom.com>
8.7 ( 2.4/ 6.3/ 4.2) 4 kevin@prism.ig.utexas.edu (Kevin Johnson)
8.6 ( 2.4/ 5.7/ 5.5) 3 Steven Line <sline@rdss.com>
8.6 ( 3.1/ 5.5/ 3.4) 4 "Dude Man" <dudeman@dude.com>
8.6 ( 4.4/ 3.7/ 1.5) 5 Per Kistler <kistler@fnmail.com>
8.6 ( 3.8/ 4.8/ 3.6) 5 Ian Mortimer <ianmorty@nortelnetworks.com>
8.0 ( 3.3/ 4.7/ 4.1) 5 "Paul Glidden" <paul.glidden@unisys.com>
These posters accounted for 3.4% of the total volume.
Top 10 Posters by OCR (minimum of three posts)
==============================================
(kb) (kb)
OCR orig / body Posts Address
----- -------------- ----- -------
1.000 ( 1.4 / 1.4) 3 hoz@rocketmail.com (hoz)
1.000 ( 0.0 / 0.0) 3 "kent" <kent7777@hutchcity.com>
0.999 ( 2.7 / 2.7) 3 Robin Senior <therobin@nortelnetworks.com>
0.953 ( 5.5 / 5.7) 3 Steven Line <sline@rdss.com>
0.868 ( 4.1 / 4.7) 5 "Paul Glidden" <paul.glidden@unisys.com>
0.853 ( 1.8 / 2.1) 4 davidq@NOSPAMpost.almac.co.uk (David Quinton)
0.823 ( 2.0 / 2.4) 4 "John Hennessy" <john@hendigital.com.au>
0.790 ( 1.7 / 2.1) 4 "Brendan Reville" <breville@mpce.mq.edu.au>
0.787 ( 6.3 / 8.0) 10 elaine ashton <elaine@chaos.wustl.edu>
0.748 ( 3.6 / 4.8) 5 Ian Mortimer <ianmorty@nortelnetworks.com>
Bottom 10 Posters by OCR (minimum of three posts)
=================================================
(kb) (kb)
OCR orig / body Posts Address
----- -------------- ----- -------
0.436 ( 0.9 / 2.0) 5 Matt Sergeant <matt@sergeant.org>
0.435 ( 1.4 / 3.1) 3 "M. Brian Akins" <bakins@mediaone.net>
0.413 ( 1.5 / 3.7) 5 Per Kistler <kistler@fnmail.com>
0.392 ( 1.3 / 3.3) 3 Dafydd Hopkin <dafydd@gointernet.co.uk>
0.380 ( 1.0 / 2.7) 3 "angelonearth" <dtse@earthweb.com>
0.371 ( 0.7 / 1.9) 3 "Anders Thorsby" <artsoft@danbbs.dk>
0.365 ( 0.4 / 1.1) 3 saku.eisikanautaa@ytti.net (Saku Ytti)
0.362 ( 1.1 / 2.9) 3 "Warren McCoy" <perl@dfwplaza.com>
0.361 ( 0.7 / 1.9) 3 dennis <dennis.moreno@pop.safetran.com>
0.223 ( 0.4 / 1.8) 3 "Torcuato" <torcu99@teleline.es>
32 posters (11%) had at least three posts.
Top 10 Crossposters
===================
Articles Address
-------- -------
3 Eric Vrabel <evrabel@earthlink.net>
3 mercurius_1@yahoo.com
3 "Bryn Waibel" <bwaibel@hotmail.com>
3 Jamie Jackson <jdjacksn@earthlink.net>
2 lhuang@bsr6.uwaterloo.ca (Larry Huang)
2 Ng Pheng Siong <ngps@my-deja.com>
2 tbittner@my-deja.com
2 "Keri Hardwick" <kerih@nospam.sprintmail.com>
2 Nicolas Moeri <moeri@sgi.com>
2 Ola =?iso-8859-1?Q?Str=F8mman?= <olast@dagbladet.no>
------------------------------
Date: 12 Jul 1999 14:48:10 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Pattern match counting
Message-Id: <7mcv7a$rp$3@info2.uah.edu>
In article <1dup4rh.hsajife52bwzN@p58.tc2.state.ma.tiac.com>,
rjk@linguist.dartmouth.edu (Ronald J Kimball) writes:
: Are you trying to make a point, or are you just wanking off by repeating
: yourself over and over again?
I was trying to make a point in the great-great-grandparent article
to this one, but it was ignored. I felt it to be an important point,
so I wanted to be sure Larry saw it.
: Being a patronizing ass will not convince anyone that you are right.
What I tell you three times is true.
Greg
--
The circle algorithm was invented by mistake when I tried to save one
register in a display hack!
-- Minsky
------------------------------
Date: 12 Jul 1999 14:39:35 GMT
From: John Jensen <jjens@primenet.com>
Subject: Perl code finds Perl to be popular! (Was: faster grep?)
Message-Id: <7mcun7$att$1@nnrp02.primenet.com>
John Jensen <jjens@primenet.com> wrote:
: As I move on to the display aspect of my problem I think I will be
: using perl cgi's. That's the nice thing about having lots of tools in
: your toolbox - choosing the one that feels right.
I've moved a bit further with my project, and I now have some results to
share.
I've recreated a search engine I had set up back in 1996. The engine
searches the misc.jobs.offered and misc.jobs.contract news feeds and does
frequency counts on various words and word patterns:
http://www.robojob.com/lang.html
It is kind of interesting to see Perl pop up as a very frequently
requested technology.
I think my next Perl task will be a semi-ad-hoc query page.
Any suggestions, or other strings/tokens/concepts to track?
Best Wishes,
John
------------------------------
Date: Mon, 12 Jul 1999 14:11:37 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: regex question
Message-Id: <378cf6e0.9792193@news.skynet.be>
Wayne Collins wrote:
>What client would you recommend?
>Your answer is not clear. I expected * to match on zero or more of
>whatever character
>was at the start of the line, as long as it is F,S or D.
>> >if($s =~ /^(F|S|D)*e$/){
It does. It will match "Fe", "FFe", "e" and also "FDSFSDe". But not
"Date". Neither "a" or "t" is in what you accept.
I don't quite understand what you want. You're saying "It may begin with
"F", "S", "D", but then again, it may not." That's very vague, isn't it?
Bart.
------------------------------
Date: 12 Jul 1999 15:20:48 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: regex question
Message-Id: <3789f9c0@newsread3.dircon.co.uk>
Wayne Collins <wcollins@cableworks.org> wrote:
> This is a multi-part message in MIME format.
> --------------4995FCD9CA9DB5CF14983E91
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
Oi !
> This program prints "period required" (without the quotes).
> I expected both if() conditions to evaluate true.
> I expected the asterisk to match on zero or more of whatever character
> preceded it.
> Can anyone explain why the first if() condition is false?
> Thanks.
>
> #!/usr/bin/perl -w
> use strict;
> my $s = "From Subject Date";
>
> if($s =~ /^(F|S|D)*e$/){
> print "no period\n";
> }
> if($s =~ /^(F|S|D).*e$/){
> print "period required\n";
> }
>
>
Because the string does not match zero or more F or S or D followed by an
e
ie it is not
e
Fe
FFe
Se
SSSe
DDDDDe
or any other combination.
/J\
--
"Like Anne Robinson in a Korean restaurant, it'll be dog eat dog" -
Graham Norton
------------------------------
Date: Mon, 12 Jul 1999 10:57:10 -0400
From: "Scott P. Renton" <scott@cablesoft.com>
To: Wayne Collins <wcollins@cableworks.org>
Subject: Re: regex question
Message-Id: <378A0245.B9064254@cablesoft.com>
Greetings!
The first condition is false because it IS false! (sorry! couldn't help myself...) The
problem lies in the test...Let's take a look:
if ($s =~ /^(F|S|D)*e$/)
What you are trying to sy here is: "if the first caracter is an F, an S, or a D, then some
other stuff, then an e at the end, do this..
What you are actually saying is..this is true if there is a ( at the beginning of the line,
followed by these characters, followed by 0 or more )...
Try putting a backslash in the matching statement so it looks like...
if ($s =~ /^\(F|S|D\)*e$/)
Remember, the backslash tells the match that the following is a special character...
Scott
p.s. IF you look at your second regexp, you might notice a similar problem...hint, hint.
Wayne Collins wrote:
> This program prints "period required" (without the quotes).
> I expected both if() conditions to evaluate true.
> I expected the asterisk to match on zero or more of whatever character
> preceded it.
> Can anyone explain why the first if() condition is false?
> Thanks.
>
> #!/usr/bin/perl -w
> use strict;
> my $s = "From Subject Date";
>
> if($s =~ /^(F|S|D)*e$/){
> print "no period\n";
> }
> if($s =~ /^(F|S|D).*e$/){
> print "period required\n";
> }
>
> ------------------------------------------------------------------------
>
> Wayne Collins <collinw@mail.mohawkc.on.ca>
> Professor
> Mohawk College of Applied Arts and Technology
> Computer Science and Information Technology
>
> Wayne Collins
> Professor <collinw@mail.mohawkc.on.ca>
> Mohawk College of Applied Arts and Technology
> Computer Science and Information Technology
> Fennell Campus P.O. box 2034 L8N 3T2;Hamilton;Ontario;; Work: (905)575-1212 x3226
> Netscape Conference Address
> Additional Information:
> Last Name Collins
> First Name Wayne
> Version 2.1
------------------------------
Date: Mon, 12 Jul 1999 14:50:53 GMT
From: <sskinner@cloud9.net>
Subject: Re: single instance log file
Message-Id: <931791053.710.56@news.remarQ.com>
Here's my version. I hobbled this together from your suggestions...
#!/usr/local/bin/perl
open (FILEHANDLE, "+$myPath") or die "\n";
flock (FILEHANDLE, 2) or die "\n";
@items = <FILEHANDLE>;
undef %items;
for (@items) {
$items{$_} = 1;
}
unless ($items{"$ENV{'HTTP_USER_AGENT'}\n"}) {
print FILEHANDLE "$ENV{'HTTP_USER_AGENT'}\n";
}
close FILEHANDLE;
I'm not sure if I have to unlock a file after I close it. Also, I guess I
could chomp instead of checking with the "\n" but then why add an extra
function?
Ugh, I just noticed I forgot the "-w" flag again. Please don't flog me
guys.
Sorry I called you a bot, Anno. Thanks for your help.
-S
------------------------------
Date: 12 Jul 1999 14:34:50 GMT
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: Statistics for comp.lang.perl.misc
Message-Id: <7mcuea$19n$1@info2.uah.edu>
Following is a summary of articles spanning a 7 day period,
beginning at 05 Jul 1999 14:16:47 GMT and ending at
12 Jul 1999 07:42:37 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" email 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) 1999 Greg Bacon.
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\@(?:.*\.)?perl\.com
Totals
======
Posters: 567
Articles: 1810 (821 with cutlined signatures)
Threads: 468
Volume generated: 3131.5 kb
- headers: 1427.2 kb (28,514 lines)
- bodies: 1532.2 kb (49,427 lines)
- original: 1049.0 kb (36,519 lines)
- signatures: 170.3 kb (3,398 lines)
Original Content Rating: 0.685
Averages
========
Posts per poster: 3.2
median: 1 post
mode: 1 post - 321 posters
s: 12.3 posts
Posts per thread: 3.9
median: 3.0 posts
mode: 2 posts - 112 threads
s: 4.2 posts
Message size: 1771.6 bytes
- header: 807.4 bytes (15.8 lines)
- body: 866.8 bytes (27.3 lines)
- original: 593.5 bytes (20.2 lines)
- signature: 96.3 bytes (1.9 lines)
Top 10 Posters by Number of Posts
=================================
(kb) (kb) (kb) (kb)
Posts Volume ( hdr/ body/ orig) Address
----- -------------------------- -------
178 414.2 (201.3/135.0/127.6) abigail@delanet.com
71 113.3 ( 55.3/ 46.3/ 22.6) Jonathan Stowe <gellyfish@gellyfish.com>
55 104.2 ( 36.1/ 61.8/ 35.4) lr@hpl.hp.com (Larry Rosler)
49 102.9 ( 42.5/ 41.8/ 19.6) Uri Guttman <uri@sysarch.com>
47 83.6 ( 38.5/ 39.7/ 25.1) David Cassell <cassell@mail.cor.epa.gov>
45 71.0 ( 34.9/ 34.0/ 23.9) e-lephant@b-igpond.com (elephant)
40 78.2 ( 33.0/ 40.0/ 32.3) tchrist@mox.perl.com (Tom Christiansen)
35 50.4 ( 30.1/ 20.2/ 12.0) bart.lateur@skynet.be (Bart Lateur)
30 46.8 ( 21.9/ 18.1/ 9.9) rjk@linguist.dartmouth.edu (Ronald J Kimball)
25 43.2 ( 15.3/ 27.8/ 11.5) anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
These posters accounted for 31.8% of all articles.
Top 10 Posters by Volume
========================
(kb) (kb) (kb) (kb)
Volume ( hdr/ body/ orig) Posts Address
-------------------------- ----- -------
414.2 (201.3/135.0/127.6) 178 abigail@delanet.com
113.3 ( 55.3/ 46.3/ 22.6) 71 Jonathan Stowe <gellyfish@gellyfish.com>
104.2 ( 36.1/ 61.8/ 35.4) 55 lr@hpl.hp.com (Larry Rosler)
102.9 ( 42.5/ 41.8/ 19.6) 49 Uri Guttman <uri@sysarch.com>
83.6 ( 38.5/ 39.7/ 25.1) 47 David Cassell <cassell@mail.cor.epa.gov>
78.2 ( 33.0/ 40.0/ 32.3) 40 tchrist@mox.perl.com (Tom Christiansen)
71.0 ( 34.9/ 34.0/ 23.9) 45 e-lephant@b-igpond.com (elephant)
50.4 ( 30.1/ 20.2/ 12.0) 35 bart.lateur@skynet.be (Bart Lateur)
48.0 ( 17.1/ 28.4/ 22.8) 23 Greg Bacon <gbacon@cs.uah.edu>
46.8 ( 21.9/ 18.1/ 9.9) 30 rjk@linguist.dartmouth.edu (Ronald J Kimball)
These posters accounted for 35.5% of the total volume.
Top 10 Posters by OCR (minimum of five posts)
==============================================
(kb) (kb)
OCR orig / body Posts Address
----- -------------- ----- -------
1.000 ( 3.6 / 3.6) 6 andrew-johnson@home.com
0.945 (127.6 /135.0) 178 abigail@delanet.com
0.899 ( 5.1 / 5.6) 11 fl_aggie@thepentagon.com
0.868 ( 4.1 / 4.7) 5 "Paul Glidden" <paul.glidden@unisys.com>
0.854 ( 12.8 / 15.0) 20 Ashish Kadakia <anonymous@web.remarq.com>
0.838 ( 2.9 / 3.4) 5 nmorison@ozemail.com.au
0.806 ( 32.3 / 40.0) 40 tchrist@mox.perl.com (Tom Christiansen)
0.801 ( 22.8 / 28.4) 23 Greg Bacon <gbacon@cs.uah.edu>
0.800 ( 5.0 / 6.2) 5 "Alan J. Flavell" <flavell@mail.cern.ch>
0.787 ( 6.3 / 8.0) 10 elaine ashton <elaine@chaos.wustl.edu>
Bottom 10 Posters by OCR (minimum of five posts)
=================================================
(kb) (kb)
OCR orig / body Posts Address
----- -------------- ----- -------
0.444 ( 2.1 / 4.7) 6 ilya@math.ohio-state.edu (Ilya Zakharevich)
0.441 ( 1.4 / 3.2) 6 ebohlman@netcom.com (Eric Bohlman)
0.436 ( 0.9 / 2.0) 5 Matt Sergeant <matt@sergeant.org>
0.432 ( 3.5 / 8.0) 12 tgy@chocobo.org
0.415 ( 11.5 / 27.8) 25 anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
0.413 ( 1.5 / 3.7) 5 Per Kistler <kistler@fnmail.com>
0.394 ( 4.5 / 11.4) 16 backwards.saerdna@srm.hc (Andreas Fehr)
0.378 ( 3.3 / 8.7) 12 Jordan Hiller <hiller@email.com>
0.350 ( 0.9 / 2.6) 5 Jukka Juslin <jukka.juslin@cern.ch>
0.300 ( 1.9 / 6.5) 8 keydet89@yahoo.com
57 posters (10%) had at least five posts.
Top 10 Threads by Number of Posts
=================================
Posts Subject
----- -------
39 I need to hide the source
22 Changing case local-specifically
21 How to dereference an array reference?
21 checking Perl offline
21 Pattern match counting
19 Help -- Weird Increments (MacPerl)
17 hiring perl programmers
16 Random Numbers
16 array stuff..
16 FAQ 5.7: How can I use a filehandle indirectly?
These threads accounted for 11.5% of all articles.
Top 10 Threads by Volume
========================
(kb) (kb) (kb) (kb)
Volume ( hdr/ body/ orig) Posts Subject
-------------------------- ----- -------
67.9 ( 33.6/ 29.8/ 16.6) 39 I need to hide the source
48.5 ( 19.9/ 25.4/ 20.6) 21 How to dereference an array reference?
48.5 ( 3.0/ 45.0/ 43.3) 4 Chatpro 2.5 glitch... Help
48.0 ( 20.1/ 23.8/ 14.6) 22 Changing case local-specifically
45.8 ( 13.6/ 29.4/ 21.5) 16 Random Numbers
42.6 ( 15.7/ 25.9/ 16.9) 19 Help -- Weird Increments (MacPerl)
40.4 ( 16.7/ 21.1/ 15.8) 21 checking Perl offline
39.1 ( 18.7/ 17.5/ 14.0) 17 hiring perl programmers
38.6 ( 16.9/ 19.4/ 10.1) 21 Pattern match counting
29.7 ( 9.4/ 17.4/ 10.6) 11 Stat Function and File Test Operators
These threads accounted for 14.3% of the total volume.
Top 10 Threads by OCR (minimum of five posts)
==============================================
(kb) (kb)
OCR orig / body Posts Subject
----- -------------- ----- -------
0.892 ( 5.1/ 5.7) 5 Asking a server "are you there?"
0.891 ( 3.2/ 3.6) 8 help with read( )
0.882 ( 6.0/ 6.8) 10 Assocative Arrays
0.865 ( 2.1/ 2.4) 5 Perl & mySQL - Please Help!
0.855 ( 4.8/ 5.6) 6 Question for regex gurus.
0.831 ( 7.0/ 8.4) 9 regex to eat all html tags
0.820 ( 9.6/ 11.6) 15 Deleting everything after a pattern?
0.813 ( 20.6/ 25.4) 21 How to dereference an array reference?
0.812 ( 4.1/ 5.0) 10 How to format date and year string?
0.805 ( 3.8/ 4.7) 5 beginner's sorting problem
Bottom 10 Threads by OCR (minimum of five posts)
=================================================
(kb) (kb)
OCR orig / body Posts Subject
----- -------------- ----- -------
0.481 ( 1.5 / 3.2) 5 PERLFUNC: tr/// - transliterate a string
0.472 ( 2.4 / 5.1) 9 ftp
0.466 ( 2.3 / 4.9) 7 Active Perl Problems
0.446 ( 1.1 / 2.4) 5 apache webserver question
0.440 ( 2.3 / 5.2) 8 Accessing POP mail?
0.428 ( 2.2 / 5.1) 5 PERL: read dir and print out its files - Engels
0.423 ( 2.3 / 5.5) 6 Perl/CGI Combined file upload & e-mail
0.419 ( 1.5 / 3.7) 6 Min/Max Problem
0.405 ( 3.0 / 7.4) 5 Problem with a SQL statement in a Perl script
0.237 ( 0.9 / 3.9) 5 Bloated code
128 threads (27%) had at least five posts.
Top 10 Targets for Crossposts
=============================
Articles Newsgroup
-------- ---------
18 comp.lang.perl.modules
5 nl.internet.www.ontwerp
4 comp.lang.perl
4 microsoft.public.inetserver.asp.general
4 comp.unix.aix
4 comp.lang.javascript
4 microsoft.public.inetserver.iis.activeserverpages
3 comp.os.ms-windows.nt
3 comp.os.ms-windows.nt.admin.misc
2 alt.perl
Top 10 Crossposters
===================
Articles Address
-------- -------
8 gls@noreply.com
3 mercurius_1@yahoo.com
3 "Rik." <rusenet@bigfoot.com>
3 Eric Vrabel <evrabel@earthlink.net>
3 Jamie Jackson <jdjacksn@earthlink.net>
3 "Bryn Waibel" <bwaibel@hotmail.com>
2 Ola =?iso-8859-1?Q?Str=F8mman?= <olast@dagbladet.no>
2 Nicolas Moeri <moeri@sgi.com>
2 tchrist@mox.perl.com (Tom Christiansen)
2 webmuse@my-deja.com
------------------------------
Date: Mon, 12 Jul 1999 10:59:12 -0400
From: "Greg Marler" <webmaster@ieo.com>
Subject: Unix Perl Script ported to NT problem
Message-Id: <7mcvr2$6i3@ns1.tsolv.com>
I am having a difficult time getting a script ported from Unix to NT, I have
placed a description of the problem and downloadable versions of the scripts
in question on a website for anyone who may have a few minutes to look at
them. Thanks in advance.
The URL is::
http://www.ieo.com/webadverts/webadverts.html
Greg Marler
------------------------------
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 118
*************************************