[16597] in Perl-Users-Digest
Perl-Users Digest, Issue: 4009 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 14 11:05:28 2000
Date: Mon, 14 Aug 2000 08:05:10 -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: <966265509-v9-i4009@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 14 Aug 2000 Volume: 9 Number: 4009
Today's topics:
Re: GET HEALTHY 3249 <mjcarman@home.com>
grep() optimisation (Anno Siegel)
Re: launch a browser and get a URL (Harold007)
Re: Negativity in Newsgroup -- Solution <mjcarman@home.com>
Re: Negativity in Newsgroup <jeff@vpservices.com>
Re: Net::SMTP is this package available for Win32 PERL? psb154@my-deja.com
New posters to comp.lang.perl.misc <gbacon@cs.uah.edu>
Re: Oracle connectivity using Perl <newsposter@cthulhu.demon.nl>
Re: Pattern Matching Question (Mike Stok)
Re: Perl code for a newbie!! <craig.pugsley@mimesweeper.com>
Re: Perl code for a newbie!! <kperrier@blkbox.com>
Re: Perl code for a newbie!! <craig.pugsley@mimesweeper.com>
print problem <mail@mail.com>
regex jponder9@my-deja.com
Re: set variable to results of regex <glued2NOglSPAM@hotmail.com.invalid>
Re: smarter way to do this (oneliner ?)? (Colin Keith)
Statistics for comp.lang.perl.misc <gbacon@cs.uah.edu>
Re: Substituting newlines for HTML equivalent (Keith Calvert Ivey)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 14 Aug 2000 08:56:03 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: GET HEALTHY 3249
Message-Id: <3997FA73.E9F0C7A4@home.com>
x wrote:
>
> On Sun, 13 Aug 2000 08:54:39 GMT, ggdbfm@yahoo.com wrote:
>
> > I lost a tone of weight using his personalized weight loss
> > program and services directly over the internet. [...]
> > Sorry if I posted in the wrong area, I am new at this. If I
> > did it wont happen again
>
> [...] you are a professional [...] spammer [...]
What? You mean that posting about a diet program to a comp.* ng wasn't
an honest mistake?
-mjc
------------------------------
Date: 14 Aug 2000 13:13:44 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: grep() optimisation
Message-Id: <8n8ra8$ev4$1@lublin.zrz.tu-berlin.de>
fvw <fvw+usenet@var.cx> wrote in comp.lang.perl.misc:
><3997cde7.3c98$31e@news.op.net> (mjd@plover.com):
>>In article <966231197VVC.fvw@var.cx>, fvw <fvw+usenet@var.cx> wrote:
>[snip good solution for a different case]
>
>My apologies, I have not been clear enough. My data always consists
>of 6 colon-terminated strings, followed by a string that I have to
>check for matching of substrings. so tr/:// would end up always end up
>>=6. The reason I've added the ([^:]:){6} to the beginning of the regexp
>is to stop anything from $b from matching anywhere in the first fields
>of the string. After advice from someone in this group, I've already
>added a ^ to the beginning of it (resulting in a huge speed gain), which
>might make it a bit more clear that all I want to do is ignore the first
>six colon-terminated fields, while still preserving them in the result
>of the grep().
In that case you may be able to save some time if you prepare a
secondary array with the colon-containing prefix chopped off once
and for all. That way, m/^([^:]:){6}/ will only have to run once
for each of the strings.
Clever use of m//g and the \G assertion could even save about as
much without an auxiliary array.
Anno
------------------------------
Date: 14 Aug 2000 13:52:52 GMT
From: harold007@aol.com (Harold007)
Subject: Re: launch a browser and get a URL
Message-Id: <20000814095252.00388.00002040@ng-ch1.aol.com>
Found this example in the ActivePerl PDK examples. This uses LWP module within
PerlScript
Dim objPerlCOM
Set objPerlCOM = CreateObject("PerlCOM.Script")
' Use the LWP::Simple package.
'
Dim objLWPSimple
Set objLWPSimple = objPerlCOM.UsePackage("LWP::Simple")
' Find out the name of the temporary directory
'
Dim objEnv
Set objEnv = WScript.CreateObject("WScript.Shell").Environment("Process")
tempfile = objEnv("TEMP") & "\temp.html"
' Fetch the ActiveState home page and save it into a temporary file.
'
rc = objLWPSimple.getstore("http://www.ActiveState.com", tempfile)
if objLWPSimple.is_success(rc) Then
' Create a browser and navigate it to the temporary file.
'
Dim objBrowser
Set objBrowser = WScript.CreateObject("InternetExplorer.Application")
objBrowser.Visible = true
objBrowser.Navigate(tempfile)
Else
MsgBox "Could not fetch the URL.", vbOKOnly, "Error"
End If
------------------------------
Date: Mon, 14 Aug 2000 08:36:32 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: Negativity in Newsgroup -- Solution
Message-Id: <3997F5E0.D300C765@home.com>
"Ricky J. Sethi" wrote:
>
> why doesn't someone create a comp.lang.perl.newbie newsgroup?
I forsee a high rate of burnout among the advice-givers there. :/
> Or, better still, newbies.* to serve as a forum for beginners in
> everything everywhere?
There are such forums, actually, but there are a couple problems:
1) Joe Average cannot be bothered to read the 'newbie' group because
he's not interested in learning netiquette at the moment;
he has a question and he wants/needs it answered *now*.
2) As a newcomer to Usenet, Joe probably doesn't have any idea that
there are rules of etiquette and that there is a newsgroup to
teach him what they are.
-mjc
------------------------------
Date: Mon, 14 Aug 2000 07:39:01 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Negativity in Newsgroup
Message-Id: <39980485.7919608A@vpservices.com>
jthornton@my-deja.com wrote:
>
> You might look at the way questions (people) are handled in this
> newsgroup (and other newsgroups) as a right-of-passage...
>
> In article <39947037.905C0883@home.com>,
[snip entire quoted article posted in jeopardy style]
Then I guess you haven't been initiated yet since you ignored the often
repeated requests to post your response after what you are responding to
and to trim the quoted material to only what is relevant. Try it, we'll
like it, and it's alot easier than adult circumcision.
--
Jeff
------------------------------
Date: Mon, 14 Aug 2000 13:00:52 GMT
From: psb154@my-deja.com
Subject: Re: Net::SMTP is this package available for Win32 PERL?
Message-Id: <8n8qi2$qt0$1@nnrp1.deja.com>
Well, I have found another PERL solution which meets my needs nicely.
http://jenda.krynicky.cz/perl/Sender.pm
Downloaded this:
http://jenda.krynicky.cz/perl/Mail-Sender-0.7.05.tar.gz
I put sender.pm in \perl\lib\mail\
all set! The examples that are given in the documentation (html) file
work well. So thank you Jenda.
--Paul Butterfield.
In article <8n8kib$mr3$1@nnrp1.deja.com>,
psb154@my-deja.com wrote:
> Hello,
>
> Can someone point me at an ftp/http site where I can download the
> package:
> net:smtp
>
> for Win32 PERL please.
>
> Thank you for your help
> --Paul Butterfield.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 14 Aug 2000 13:46:21 GMT
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: New posters to comp.lang.perl.misc
Message-Id: <spfu1dmgn4t90@corp.supernews.com>
Following is a summary of articles from new posters spanning a 7 day
period, beginning at 07 Aug 2000 14:40:42 GMT and ending at
14 Aug 2000 13:54:53 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) 2000 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: 222 (45.0% of all posters)
Articles: 419 (23.8% of all articles)
Volume generated: 768.5 kb (24.4% of total volume)
- headers: 328.6 kb (6,625 lines)
- bodies: 437.0 kb (15,388 lines)
- original: 308.6 kb (11,642 lines)
- signatures: 2.5 kb (79 lines)
Original Content Rating: 0.706
Averages
========
Posts per poster: 1.9
median: 1.0 post
mode: 1 post - 139 posters
s: 2.1 posts
Message size: 1878.2 bytes
- header: 803.1 bytes (15.8 lines)
- body: 1067.9 bytes (36.7 lines)
- original: 754.1 bytes (27.8 lines)
- signature: 6.2 bytes (0.2 lines)
Top 10 Posters by Number of Posts
=================================
(kb) (kb) (kb) (kb)
Posts Volume ( hdr/ body/ orig) Address
----- -------------------------- -------
15 21.3 ( 11.7/ 9.2/ 5.7) Ren Maddox <ren.maddox@tivoli.com>
10 21.2 ( 10.5/ 10.7/ 3.2) "Craig Pugsley" <craig.pugsley@mimesweeper.com>
10 20.8 ( 8.4/ 12.4/ 7.3) DM <drawbridge@home.com>
10 15.9 ( 8.5/ 7.3/ 3.5) Javier Hijas <jhijas@yahoo.es>
9 22.1 ( 7.2/ 14.9/ 3.9) "Christopher M. Jones" <christopher_j@uswest.net>
9 15.0 ( 7.7/ 7.3/ 3.6) "Etienne Laverdiere" <info@digitaltango.com>
8 14.5 ( 5.7/ 8.8/ 7.4) vagabond_nomad@my-deja.com
7 24.2 ( 6.7/ 17.5/ 8.1) vrillusions@mail.com
7 9.7 ( 6.0/ 3.7/ 2.5) "Kermit" <as@if.com>
7 8.0 ( 5.2/ 2.7/ 2.7) thirdgc@my-deja.com
These posters accounted for 5.2% of all articles.
Top 10 Posters by Volume
========================
(kb) (kb) (kb) (kb)
Volume ( hdr/ body/ orig) Posts Address
-------------------------- ----- -------
26.7 ( 0.7/ 26.0/ 25.9) 1 anhedonia <ajgilgis@midway.uchicago.edu>
24.2 ( 6.7/ 17.5/ 8.1) 7 vrillusions@mail.com
22.1 ( 7.2/ 14.9/ 3.9) 9 "Christopher M. Jones" <christopher_j@uswest.net>
21.3 ( 11.7/ 9.2/ 5.7) 15 Ren Maddox <ren.maddox@tivoli.com>
21.2 ( 10.5/ 10.7/ 3.2) 10 "Craig Pugsley" <craig.pugsley@mimesweeper.com>
20.8 ( 8.4/ 12.4/ 7.3) 10 DM <drawbridge@home.com>
17.8 ( 1.4/ 16.5/ 15.2) 2 anevynni@my-deja.com
16.0 ( 4.2/ 11.8/ 11.1) 5 Peter_Gadsby <peter_gadsbyNOpeSPAM@hfcbank.co.uk.invalid>
15.9 ( 8.5/ 7.3/ 3.5) 10 Javier Hijas <jhijas@yahoo.es>
15.0 ( 7.7/ 7.3/ 3.6) 9 "Etienne Laverdiere" <info@digitaltango.com>
These posters accounted for 6.4% of the total volume.
Top 10 Posters by OCR (minimum of three posts)
==============================================
(kb) (kb)
OCR orig / body Posts Address
----- -------------- ----- -------
1.000 ( 6.7 / 6.7) 4 Mahesh Asolkar <mahesha@nital.stpp.soft.net>
1.000 ( 2.7 / 2.7) 7 thirdgc@my-deja.com
1.000 ( 1.7 / 1.7) 3 Savant_cubed <superegoNOsuSPAM@execs.com.invalid>
1.000 ( 1.4 / 1.4) 3 "Nick Gushlow" (@) <nick.gushlowusa.net>
0.961 ( 1.0 / 1.0) 3 "Rajeev" <rajeev@faircomm.net>
0.943 ( 11.1 / 11.8) 5 Peter_Gadsby <peter_gadsbyNOpeSPAM@hfcbank.co.uk.invalid>
0.913 ( 1.2 / 1.3) 3 "Jim_Kearman" <jkearmanNO@mindspring.com>
0.876 ( 5.2 / 6.0) 4 maheshasolkar@engineer.com
0.866 ( 1.6 / 1.9) 3 Steve Button <steve_button@my-deja.com>
0.864 ( 4.5 / 5.2) 3 Chris Barnabo <chris@spagnet.com>
Bottom 10 Posters by OCR (minimum of three posts)
=================================================
(kb) (kb)
OCR orig / body Posts Address
----- -------------- ----- -------
0.477 ( 3.5 / 7.3) 10 Javier Hijas <jhijas@yahoo.es>
0.465 ( 8.1 / 17.5) 7 vrillusions@mail.com
0.462 ( 1.9 / 4.1) 3 btaneja@my-deja.com
0.437 ( 2.4 / 5.5) 6 marvin <alesr@siol.net>
0.419 ( 3.0 / 7.2) 5 Albert Dewey <timewarp@shentel.net>
0.334 ( 0.8 / 2.5) 3 brian@socko.net
0.304 ( 1.0 / 3.3) 3 kaivix@angelfire.com
0.297 ( 3.2 / 10.7) 10 "Craig Pugsley" <craig.pugsley@mimesweeper.com>
0.265 ( 3.9 / 14.9) 9 "Christopher M. Jones" <christopher_j@uswest.net>
0.203 ( 0.6 / 3.1) 4 u2orange <u2o@u2orange.co.uk>
36 posters (16%) had at least three posts.
Top 10 Targets for Crossposts
=============================
Articles Newsgroup
-------- ---------
28 comp.lang.perl.modules
19 alt.perl
15 comp.lang.perl
8 comp.lang.java.misc
8 comp.lang.misc
8 comp.unix.questions
8 comp.lang.java.help
8 newsone.log
8 comp.lang.java
7 comp.mail.misc
Top 10 Crossposters
===================
Articles Address
-------- -------
10 Matthew M. Huntbach <mmh@dcs.qmw.ac.uk>
5 "COM Service" <webmaster@swap-resources.com>
5 Balakamatchi Loganathan <lbalakamatchi@selectica.com>
5 "sevensoft" <info@sevensoft.net>
5 Cannon Fodder <technews@NOSPAMns.sympatico.ca>
4 maheshasolkar@engineer.com
3 Mahesh Asolkar <mahesha@nital.stpp.soft.net>
3 "the_master" <idonthinkso@NOPE.com>
2 Dave Bitner <david.bitner@noaa.gov>
2 Thomas Demuth <thomas.demuth@fernuni-hagen.de>
------------------------------
Date: 14 Aug 2000 13:45:25 GMT
From: Erik van Roode <newsposter@cthulhu.demon.nl>
Subject: Re: Oracle connectivity using Perl
Message-Id: <8n8t5l$fag$1@internal-news.uu.net>
Peter_Gadsby <peter_gadsbyNOpeSPAM@hfcbank.co.uk.invalid> wrote:
> I've found the required switched to DBD now, and the code works
> great when running in Korn Shell..... But when I run it via the
> browser IE5, it just times out. I've cut & pasted the generated
> HTML into the browser, and it seems to work fine, I've also
> logged in as the HTTP user and the script runs correctly, so it
> doesn't seem to be a permissions thing .... HELP!!!! Script
> enclosed. Thanks
Add checks for results of prepare/execute and bind_columns. That
might reveal problems caused by the environment your script is
running in not being set up properly.
Did you check the checklist in:
http://www.cpan.org/doc/FAQs/cgi/idiots-guide.html
(Especially the 'What's in the server error log?'
I'm slightly puzzled by the '$b=$ARGV[0];' line. I assume you're
trying to pass a parameter to the script, but CGI does not work
that way. How are you calling the script?
Note that your script looks fine. This doesn't seem to be a Perl
issue, but a CGI/webserver one, so you might want to check out
comp.infosystems.www.authoring.cgi or a newsgroup about your webserver.
Or email me about the $b=$ARGV[0], that might be the problem.
Erik
------------------------------
Date: Mon, 14 Aug 2000 13:26:32 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Pattern Matching Question
Message-Id: <csSl5.53379$0l6.112899@typhoon.austin.rr.com>
In article <39977812.39A85C6F@rochester.rr.com>,
Bob Walton <bwalton@rochester.rr.com> wrote:
>David Webb wrote:
>...
>> I am trying to extract all the links and their titles from a web page. As
>> you
>> know, it is not guaranteed that all the data would be on same line.
>>
>> I was trying this
>>
>> while ($main =~ /<a href="(.*)">(.*)</a>/igm) {
>> print "$1, $2";
>> }
>HTML::Parser is what you *really* want.
Or even HTML::LinkExtor whose documentation starts out:
HTML::LinkExtorUser Contributed Perl DocumentatHTML::LinkExtor(3)
NAME
HTML::LinkExtor - Extract links from an HTML document
[...]
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ |
GPG PGP Key 1024D/059913DA | Fingerprint 0570 71CD 6790 7C28 3D60
stok@colltech.com (CT - work) | 75D2 9EC4 C1C0 0599 13DA
------------------------------
Date: Mon, 14 Aug 2000 14:13:31 +0100
From: "Craig Pugsley" <craig.pugsley@mimesweeper.com>
Subject: Re: Perl code for a newbie!!
Message-Id: <0gSl5.4639$pR4.91414@news6-win.server.ntlworld.com>
WHAT IN GOODNESS NAME ARE YOU TALKING ABOUT? I was making a (slightly
blanketed, admittedly) comment on the general state of affairs in the
tech-community on the web. Why should I have to quote examples just to
justify my (personal) comments? I think your (and all others in this thread
reflecting the same POV) comments seem to encapsulate exactly the extent to
which the tech community has disappeared up its own (proverbial) backside.
CraigP
"Alan J. Flavell" <flavell@mail.cern.ch> wrote in message
news:Pine.GHP.4.21.0008141309030.28149-100000@hpplus03.cern.ch...
> On Mon, 14 Aug 2000, Craig Pugsley hung upside-down from a news
> server and blurted out to the foregathered multitude:
>
> > I share your sentiments exactly.
>
> And then quoted three different people who had been holding a
> discussion on a particular technical detail.
>
> It's hard to see how one can hold all three points of view
> simultaneously. Maybe if you'd learn to quote...?
>
> --
>
> A patent application requires an implementation,
> which is impossible due to the lack of sufficently
> dense material to make one that would work.
> - Glenn Randers-Pehrson discussing specification for a clue-stick
>
>
------------------------------
Date: 14 Aug 2000 09:43:34 -0500
From: Kent Perrier <kperrier@blkbox.com>
Subject: Re: Perl code for a newbie!!
Message-Id: <580B3788058CD437.8355A7156882E22D.8F81E5B5E4E9F746@lp.airnews.net>
"Craig Pugsley" <craig.pugsley@mimesweeper.com> writes:
> I will pay you 10 MEEEELLLIIIOOONNN dollars if you can get it sorted.
>
> "TANSTAAFL"? - please, explain...
There
Ain't
No
Such
Thing
As
A
Free
Lunch
Kent
--
We are in fact well and truly doomed.
-- Jamie Zawinski
http://www.jwz.org/gruntle/nscpdorm.html
------------------------------
Date: Mon, 14 Aug 2000 16:02:00 +0100
From: "Craig Pugsley" <craig.pugsley@mimesweeper.com>
Subject: Re: Perl code for a newbie!!
Message-Id: <JRTl5.4763$pR4.93030@news6-win.server.ntlworld.com>
I would like to request comment to the thread of a discussion I seem to be
having with the entire Tech-community on the web at the moment. Please have
a quick look over the threads above. What do you think of the comments? Am I
being hopelessly naive? Or do I have a point? All comments gratefully
received!
Thanks,
CraigP
"Kent Perrier" <kperrier@blkbox.com> wrote in message
news:580B3788058CD437.8355A7156882E22D.8F81E5B5E4E9F746@lp.airnews.net...
> "Craig Pugsley" <craig.pugsley@mimesweeper.com> writes:
>
> > I will pay you 10 MEEEELLLIIIOOONNN dollars if you can get it sorted.
> >
> > "TANSTAAFL"? - please, explain...
>
> There
> Ain't
> No
> Such
> Thing
> As
> A
> Free
> Lunch
>
>
> Kent
> --
> We are in fact well and truly doomed.
> -- Jamie Zawinski
> http://www.jwz.org/gruntle/nscpdorm.html
------------------------------
Date: Mon, 14 Aug 2000 08:50:55 -0500
From: Brian <mail@mail.com>
Subject: print problem
Message-Id: <3997F93F.27311E99@mail.com>
--------------8827D7A3CAF59477F46D1246
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Would anyone have an idea as to why this wouldn't be printing?
use CGI qw(:standard);
MAIN:{
$comment = param("comment");
open( TEMP, "<temp.txt" ) || die "Can't open temp.txt";
while(<TEMP>) {
$theLine = $_;
chomp $theLine;
}
print $theLine;
open( REC, "+<rec.txt" ) || die "Can't open rec.txt";
while(<REC>) {
chomp;
$theLine = substr( $theLine, 0, 30 );
$subThisLine = substr( $_, 0, 30 );
if( $theLine eq $subThisLine ) {
###### WHY ISN'T THIS PRINTING ###########
print REC $_, "...", $comment, "\n";
###### WHY ISN'T THIS PRINTING ###########
}
}
close REC;
close TEMP;
$url = "HTTP://localhost/lookup.html";
print "Location: $url\n\n";
exit;
}
When I step through this code it successfully makes it through the if
statement, but will not print to the rec.txt file. Pretty confused as
to why not. N E help would be much appreciated!
--------------8827D7A3CAF59477F46D1246
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<i>Would anyone have an idea as to why this wouldn't be printing?</i>
<p>use CGI qw(:standard);
<p>MAIN:{
<br> $comment = param("comment");
<br> open( TEMP, "<temp.txt" ) || die "Can't open temp.txt";
<br> while(<TEMP>) {
<br> $theLine = $_;
<br> chomp $theLine;
<br> }
<br>print $theLine;
<br>open( REC, "+<rec.txt" ) || die "Can't open rec.txt";
<br>while(<REC>) {
<br> chomp;
<br> $theLine = substr( $theLine, 0, 30 );
<br> $subThisLine = substr( $_, 0, 30 );
<br> if( $theLine eq $subThisLine ) {
<br>
<br>###### WHY ISN'T THIS PRINTING ###########
<br> print REC $_, "...", $comment, "\n";
<br>###### WHY ISN'T THIS PRINTING ###########
<p> }
<br>}
<br>close REC;
<br>close TEMP;
<br>$url = "<A HREF="HTTP://localhost/lookup.html">HTTP://localhost/lookup.html</A>";
<br>print "Location: $url\n\n";
<br>exit;
<br>}
<p><i>When I step through this code it successfully makes it through the
if statement, but will not print to the rec.txt file. Pretty confused
as to why not. N E help would be much appreciated!</i></html>
--------------8827D7A3CAF59477F46D1246--
------------------------------
Date: Mon, 14 Aug 2000 14:51:08 GMT
From: jponder9@my-deja.com
Subject: regex
Message-Id: <8n910q$vsp$1@nnrp1.deja.com>
Hi all,
This is driving me mad!! I am testing for decimal places on a
number and when encountering more than 2 i wish to substitute however
many there are for just the 2 i.e. trimming them down to 2 decimal
places. Trouble is i cant use printf (long story!) with which it would
be a doddle.
Any ideas gratefully received
Jimbo
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 14 Aug 2000 06:15:34 -0700
From: glued2 <glued2NOglSPAM@hotmail.com.invalid>
Subject: Re: set variable to results of regex
Message-Id: <00aba664.b5ae6016@usw-ex0105-036.remarq.com>
That did it.
Thank you all very much!
-------------------------------
http://www.GluedToTheScreen.com
-----------------------------------------------------------
Got questions? Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com
------------------------------
Date: Mon, 14 Aug 2000 13:16:34 GMT
From: newsgroups@ckeith.clara.net (Colin Keith)
Subject: Re: smarter way to do this (oneliner ?)?
Message-Id: <SiSl5.126$DT4.3608855@nnrp2.clara.net>
In article <3997AB70.410D9813@ostas.lu.se>, webmaster@ostas.lu.se wrote:
>Hi,
>Is it possible to call it the below code in a one-liner ?
>
>
>######## Code ########
>&KursModul::search_file("${databasdir}kurslista.data", kurskod, $kurskod);
>$kursbeskrivning = $KursModul::Record{beskrivning};
>
>####### Pseudo code ######
>The above calls a sub which search a file and creates a hash (%Record)
>of the result, then assigns the value of one item in the hash to a variable.
Yes:
while(<STDIN>){
chomp;
print;
}
There you go, one line ... :)
You are making two assignations, yes you can do it on one line, but they're
still two different statements. About the best you could do is if
search_file() returns the hash just created you could try casting it as a
hash and using:
$kursbeskrivning = ${searchfile(..)}{deskrivning};
I.e.
maia% perl -w -Mstrict
sub buildhash { return { a=>1, b=>2, c=>3 }; }
print "xx: ", ${buildhash()}{'c'}, "\n";
xx: 3
Or
print "xx ", %{buildhash()}->{c}, "\n";
But why would you want to make the code more confusing?
Col.
---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC
------------------------------
Date: Mon, 14 Aug 2000 13:46:58 GMT
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: Statistics for comp.lang.perl.misc
Message-Id: <spfu2i5tn4t177@corp.supernews.com>
Following is a summary of articles spanning a 7 day period,
beginning at 07 Aug 2000 14:40:42 GMT and ending at
14 Aug 2000 13:54:53 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) 2000 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: 493
Articles: 1764 (639 with cutlined signatures)
Threads: 453
Volume generated: 3146.0 kb
- headers: 1403.6 kb (27,850 lines)
- bodies: 1666.3 kb (55,687 lines)
- original: 1078.8 kb (39,145 lines)
- signatures: 74.4 kb (1,867 lines)
Original Content Rating: 0.647
Averages
========
Posts per poster: 3.6
median: 1 post
mode: 1 post - 255 posters
s: 6.5 posts
Posts per thread: 3.9
median: 3 posts
mode: 1 post - 112 threads
s: 5.1 posts
Message size: 1826.3 bytes
- header: 814.8 bytes (15.8 lines)
- body: 967.3 bytes (31.6 lines)
- original: 626.2 bytes (22.2 lines)
- signature: 43.2 bytes (1.1 lines)
Top 10 Posters by Number of Posts
=================================
(kb) (kb) (kb) (kb)
Posts Volume ( hdr/ body/ orig) Address
----- -------------------------- -------
51 99.8 ( 35.4/ 58.6/ 31.8) Larry Rosler <lr@hpl.hp.com>
48 105.9 ( 43.8/ 61.9/ 44.3) "Godzilla!" <godzilla@stomp.stomp.tokyo>
48 69.6 ( 36.0/ 31.3/ 18.9) Keith Calvert Ivey <kcivey@cpcug.org>
45 82.6 ( 42.2/ 38.6/ 17.5) jason <elephant@squirrelgroup.com>
45 81.8 ( 32.7/ 41.9/ 38.2) abigail@foad.org
36 78.6 ( 26.7/ 51.9/ 43.7) Colin Keith <newsgroups@ckeith.clara.net>
35 53.1 ( 31.1/ 21.8/ 14.5) Bart Lateur <bart.lateur@skynet.be>
31 46.4 ( 26.1/ 20.2/ 8.7) Drew Simonis <care227@attglobal.net>
30 56.0 ( 17.3/ 35.6/ 25.6) Greg Bacon <gbacon@cs.uah.edu>
30 56.7 ( 26.3/ 29.9/ 13.3) Abe Timmerman <abe@ztreet.demon.nl>
These posters accounted for 22.6% of all articles.
Top 10 Posters by Volume
========================
(kb) (kb) (kb) (kb)
Volume ( hdr/ body/ orig) Posts Address
-------------------------- ----- -------
105.9 ( 43.8/ 61.9/ 44.3) 48 "Godzilla!" <godzilla@stomp.stomp.tokyo>
99.8 ( 35.4/ 58.6/ 31.8) 51 Larry Rosler <lr@hpl.hp.com>
82.6 ( 42.2/ 38.6/ 17.5) 45 jason <elephant@squirrelgroup.com>
81.8 ( 32.7/ 41.9/ 38.2) 45 abigail@foad.org
78.6 ( 26.7/ 51.9/ 43.7) 36 Colin Keith <newsgroups@ckeith.clara.net>
69.6 ( 36.0/ 31.3/ 18.9) 48 Keith Calvert Ivey <kcivey@cpcug.org>
65.3 ( 31.4/ 33.1/ 25.4) 30 "Alan J. Flavell" <flavell@mail.cern.ch>
56.7 ( 26.3/ 29.9/ 13.3) 30 Abe Timmerman <abe@ztreet.demon.nl>
56.0 ( 17.3/ 35.6/ 25.6) 30 Greg Bacon <gbacon@cs.uah.edu>
53.1 ( 31.1/ 21.8/ 14.5) 35 Bart Lateur <bart.lateur@skynet.be>
These posters accounted for 23.8% of the total volume.
Top 10 Posters by OCR (minimum of five posts)
==============================================
(kb) (kb)
OCR orig / body Posts Address
----- -------------- ----- -------
1.000 ( 2.7 / 2.7) 7 thirdgc@my-deja.com
1.000 ( 4.1 / 4.1) 6 The WebDragon <nospam@nospam.com>
0.993 ( 1.8 / 1.8) 5 Rashid Saharudin <rashid1218@hotmail.com>
0.943 ( 11.1 / 11.8) 5 Peter_Gadsby <peter_gadsbyNOpeSPAM@hfcbank.co.uk.invalid>
0.913 ( 38.2 / 41.9) 45 abigail@foad.org
0.874 ( 8.8 / 10.1) 5 "Kenny Lim" <kennylim@techie.com>
0.842 ( 43.7 / 51.9) 36 Colin Keith <newsgroups@ckeith.clara.net>
0.841 ( 7.4 / 8.8) 8 vagabond_nomad@my-deja.com
0.811 ( 3.5 / 4.3) 5 andrew-johnson@home.com
0.784 ( 9.6 / 12.2) 9 "Godzilla!" <callgirl@la.znet.com>
Bottom 10 Posters by OCR (minimum of five posts)
=================================================
(kb) (kb)
OCR orig / body Posts Address
----- -------------- ----- -------
0.394 ( 3.4 / 8.7) 10 Tony L. Svanstrom <tony@svanstrom.com>
0.393 ( 4.2 / 10.7) 15 Jonathan Stowe <gellyfish@gellyfish.com>
0.374 ( 3.7 / 9.9) 5 "Baris" <sumengen@hotelspectra.com>
0.374 ( 5.2 / 14.0) 14 efflandt@xnet.com
0.373 ( 2.1 / 5.7) 5 "Guenther Degenfelder" <guenther.degenfelder@datev.de>
0.373 ( 1.2 / 3.3) 5 "Brendon Caligari" <bcaligari@shipreg.com>
0.336 ( 1.0 / 2.9) 5 Kent Perrier <kperrier@blkbox.com>
0.327 ( 2.3 / 7.0) 10 Uri Guttman <uri@sysarch.com>
0.297 ( 3.2 / 10.7) 10 "Craig Pugsley" <craig.pugsley@mimesweeper.com>
0.265 ( 3.9 / 14.9) 9 "Christopher M. Jones" <christopher_j@uswest.net>
86 posters (17%) had at least five posts.
Top 10 Threads by Number of Posts
=================================
Posts Subject
----- -------
45 Converting from US dates/numbers to European dates/numbers
41 reg expressions - protect html
32 Negativity in Newsgroup
26 Perl code for a newbie!!
18 Problems with adding 1
17 find the number of characters in a string
16 warning/var weirdness (or is it?)
15 Large-File Reformatting Problem (Regexp gurus, et al.)
15 grep() optimisation
14 CGI.PM How to get all Form's value in a HashTable?
These threads accounted for 13.5% of all articles.
Top 10 Threads by Volume
========================
(kb) (kb) (kb) (kb)
Volume ( hdr/ body/ orig) Posts Subject
-------------------------- ----- -------
85.9 ( 39.9/ 43.7/ 27.9) 41 reg expressions - protect html
83.9 ( 41.8/ 40.8/ 26.1) 45 Converting from US dates/numbers to European dates/numbers
78.8 ( 28.1/ 49.3/ 32.7) 32 Negativity in Newsgroup
46.2 ( 24.5/ 20.9/ 9.4) 26 Perl code for a newbie!!
34.1 ( 10.5/ 23.0/ 17.0) 14 Best practices....
33.0 ( 11.8/ 19.4/ 12.3) 15 grep() optimisation
31.5 ( 13.6/ 16.8/ 11.0) 17 find the number of characters in a string
31.1 ( 7.6/ 22.9/ 11.6) 10 Convert URLs to links
30.2 ( 11.6/ 17.0/ 12.1) 15 Large-File Reformatting Problem (Regexp gurus, et al.)
27.2 ( 8.1/ 17.7/ 12.4) 10 When does it pay to presize an array?
These threads accounted for 15.3% of the total volume.
Top 10 Threads by OCR (minimum of five posts)
==============================================
(kb) (kb)
OCR orig / body Posts Subject
----- -------------- ----- -------
0.962 ( 2.8/ 2.9) 5 delimited text to HTML table
0.885 ( 8.4/ 9.5) 6 Oracle connectivity using Perl
0.883 ( 4.1/ 4.7) 6 Is "close()" really necesary?
0.834 ( 8.4/ 10.1) 6 Trouble with example
0.822 ( 3.1/ 3.8) 5 How to replace the newline in perl?
0.818 ( 4.2/ 5.1) 7 Set cookie from SSI
0.770 ( 3.5/ 4.6) 7 set variable to results of regex
0.760 ( 1.9/ 2.6) 6 cleaning shell screen
0.758 ( 5.0/ 6.6) 6 Please help me!
0.751 ( 6.1/ 8.1) 7 Simple regular Expression Question
Bottom 10 Threads by OCR (minimum of five posts)
=================================================
(kb) (kb)
OCR orig / body Posts Subject
----- -------------- ----- -------
0.433 ( 1.9 / 4.4) 10 Pop Ups
0.431 ( 2.7 / 6.2) 7 Procmail vs Perl.
0.421 ( 1.9 / 4.6) 11 Cant figure this out.
0.414 ( 2.4 / 5.8) 10 undef multiple variables
0.413 ( 2.7 / 6.6) 5 IO::Socket problem
0.373 ( 1.9 / 5.1) 5 HELP!! with Install on HP-UX.. where to start!??
0.368 ( 1.7 / 4.6) 6 DBI: LAST_INSERT_ID() getting the value of
0.366 ( 0.5 / 1.5) 5 London =?iso-8859-1?Q?=A330=2D35K?= Perl Programmers Required
0.331 ( 1.5 / 4.5) 5 Dreaded 500 message
0.319 ( 1.6 / 4.9) 7 one liner?
121 threads (26%) had at least five posts.
Top 10 Targets for Crossposts
=============================
Articles Newsgroup
-------- ---------
28 comp.lang.perl.modules
19 alt.perl
15 comp.lang.perl
8 comp.lang.java.misc
8 comp.lang.misc
8 comp.unix.questions
8 comp.lang.java.help
8 newsone.log
8 comp.lang.java
7 comp.mail.misc
Top 10 Crossposters
===================
Articles Address
-------- -------
10 Matthew M. Huntbach <mmh@dcs.qmw.ac.uk>
5 Jeff Zucker <jeff@vpservices.com>
5 "sevensoft" <info@sevensoft.net>
5 Cannon Fodder <technews@NOSPAMns.sympatico.ca>
5 "COM Service" <webmaster@swap-resources.com>
5 Balakamatchi Loganathan <lbalakamatchi@selectica.com>
5 Jim Mauldin <mauldin@netstorm.net>
5 Tim Hammerquist <tim@degree.ath.cx>
4 "Kenny Lim" <kennylim@techie.net>
4 maheshasolkar@engineer.com
------------------------------
Date: Mon, 14 Aug 2000 13:43:49 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: Substituting newlines for HTML equivalent
Message-Id: <399ef73e.46509779@news.newsguy.com>
"Marr, Lincoln [HOOF:4713:EXCH]" <lincolnmarr@europem01.nt.com>
wrote:
>$field =~ s/\n/<BR>/g
>
>But the thing is, I want one newline to be replaced with <BR> but 2
>consecutive newlines to be replaced with <P>. Is this possible?
Did you try it?
$field =~ s/\n\n/<P>/g;
$field =~ s/\n/<BR>/g;
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
------------------------------
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 4009
**************************************