[9007] in Perl-Users-Digest
Perl-Users Digest, Issue: 2625 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 18 05:07:42 1998
Date: Mon, 18 May 98 02:00:34 -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: 2625
Today's topics:
' Premature end of script headers ' is pissing me off, <topdog@earthlink.net>
Re: 500 Server Error: .../somescript.pl contained no bl (J|rgen P|nter)
Re: can't find uninitialized value after while block, c (Ronald J Kimball)
Re: CGI editors for windows rkaya@makiki.net
Compiled Perl and Dynamic Loading yakk-dejanews@yakk.net.au
Re: Does Perl have a IDE?I don't like command line. (Sitaram Chamarty)
Re: Does Perl have a IDE?I don't like command line. (J|rgen P|nter)
Help Please: Perl for text substitution ? <robertf@shell5.ba.best.com>
Re: Help Please: Perl for text substitution ? (Craig Berry)
Re: Install libnet module <ebohlman@netcom.com>
Re: Is if ($a="something") a bad style? (Mark Maurer)
Re: Is if ($a="something") a bad style? (John Moreno)
Re: Is if ($a="something") a bad style? (Craig Berry)
Re: Looking for Perl TCP/IP Server Script <rootbeer@teleport.com>
Re: Nuclear bombing of NEW YORK! Small countries can ta (Martien Verbruggen)
Re: Nuclear bombing of NEW YORK! Small countries can ta <no_sp.am@agd.nsw.gov.au.x>
Re: Nuclear bombing of NEW YORK! Small countries can ta (Alexander Viro)
Re: perl binary with libraries included <rootbeer@teleport.com>
Re: Quick Question about Perl TCP/IP <ruediger@perl.pl>
Re: Regex problem: substituting 3+ identical characters (Ronald J Kimball)
Re: Regex problem: substituting 3+ identical characters (J|rgen P|nter)
Re: REGEX Question (Ronald J Kimball)
Re: sending regex matches to a separate file (Tina Marie Holmboe)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 17 May 1998 22:37:19 -0700
From: "Peter Hudson" <topdog@earthlink.net>
Subject: ' Premature end of script headers ' is pissing me off, although it seems to work
Message-Id: <6johfd$42p$1@suriname.it.earthlink.net>
I call this script from my site so that all the referers are logged to a
file, and if there isn't a referer it just forgets about it... it seems to
work perfectly, i've been running it for months, im just tired of seeing the
error message repeatedly in my error.log, which is about half the size of my
access.log, which dosnt seem right. any help would be great!
#!/usr/bin/perl
$RefererFile = "/usr/home/html/cgibin/referer.log";
$file = "$ENV{'REQUEST_URI'}";
open (COUNT,">>$RefererFile");
if (defined $ENV{'HTTP_REFERER'}) {
$doc_referer = $ENV{'HTTP_REFERER'};
}
else { exit; }
print COUNT "$doc_referer -> $file\n";
--
Peter Hudson
------------------------------
Date: 18 May 1998 05:34:35 GMT
From: Juergen.Puenter@materna.de (J|rgen P|nter)
Subject: Re: 500 Server Error: .../somescript.pl contained no blank line separating header and data
Message-Id: <6joh9b$rav$2@penthesilea.Materna.DE>
In article <355F9E33.606AA213@fccjmail.fccj.org>, webmaster@fccjmail.fccj.org
says...
>
>JD Lampard wrote:
>>
>> 500 Server Error
>> .../somescript.pl contained no blank line separating header and data.
>>
>
>Your server is talking to you :-)
>
>Do this
>
>print "Content-type: html/text\n\n";
>
>Notice two \n up there =)
Or perhaps it read:
print "Content-type: text/html";
<-- notice empty line
print ...;
and you 'tweaked' ;-) this into:
print "Content-type: text/html";
print ...;
which does not work. BTW, this thing about the two newlines is a
requirement of the HTTP, so don't blame Perl :-))
HTH
Juergen Puenter
------------------------------
Date: Mon, 18 May 1998 01:13:11 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: can't find uninitialized value after while block, causing warning
Message-Id: <1d976lm.1pmi2501e3t7y4N@bay1-128.quincy.ziplink.net>
Scott Sutherland <suthsc@ncs.com> wrote:
> The warning happens BEFORE the first iteration of the loop,
That's great, how about a line number?
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Mon, 18 May 1998 05:40:20 GMT
From: rkaya@makiki.net
To: a_klein@ix.netcom.com
Subject: Re: CGI editors for windows
Message-Id: <6johk4$rg5$1@nnrp1.dejanews.com>
In article <6jlegk$66p$1@dfw-ixnews11.ix.netcom.com>,
"Adam Klein" <a_klein@ix.netcom.com> wrote:
>
> Is there any good editors for writing CGI in windows. Something that easily
> organizes all the subs like a visual basic interface? I am really
> frustrated with programming in notepad.
>
> Thanx,
> Adam
I know nothing about the "visual basic interface", but you might try looking
at "Programmer's File Editor", by Alan Phillips, available for download at:
http://www.lancs.ac.uk/people/cpaap/pfe/
It detects whether you're working with DOS or Unix format files, and
automatically saves in the respective formats.
Raymond T. Kaya
Honolulu, Hawaii
http://www.makiki.net
http://www.reikilinks.com
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Mon, 18 May 1998 08:41:42 GMT
From: yakk-dejanews@yakk.net.au
Subject: Compiled Perl and Dynamic Loading
Message-Id: <6jos86$bus$1@nnrp1.dejanews.com>
Hi, I've spent much of my day frobbing with the perl compiler to see if I
could get some CGIs I wrote to compile.
The problem I'm running into is that the compiled perl programs (either CC or
Bytecode) can't dynamically load modules - in this case the Mysql module -
which is vital to what I'm doing.
Is it fundamentally impossible to dynamically load modules in compiled perl?
If so: is there any way to load the Mysql module statically?
If it is possible to dynamically load modules - what do I have to do to get it
to work. I'm using IRIX and Solaris.
Thanks
Ian
PS: Apart from this, the Perl Compiler is magical. Great job guys.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 18 May 98 03:19:23 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <slrn6lv8qt.b8g.sitaram@ltusitaram.diac.com>
On Sun, 17 May 1998 22:54:57 GMT, patrick.mannion@us.socgen.com
<patrick.mannion@us.socgen.com> wrote:
>Tom - I am a newcomer to Perl, and was originally attracted to the language
[lots of stuff snipped]
>just trying to grasp concepts that we have no reference for.
Wow! Do you realise that whole thing was one paragraph of 20+
lines?
I dont know if it's your newsreader or if it's your writing style
- but please, lets have some \s+ :-)
It's extremely difficult to read as it stands...
------------------------------
Date: 18 May 1998 05:11:07 GMT
From: Juergen.Puenter@materna.de (J|rgen P|nter)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6joftb$rav$1@penthesilea.Materna.DE>
In article <6jlfpf$24e$1@ultranet.com>, fsg@ultranet.com says...
>
>smcdow@arlut.utexas.edu (Stuart McDow) writes:
>>fsg@ultranet.com writes:
>>> Actually, if you want to do that, please call me at (508) 898 6490.
>>> Data General makes a product called 'TermServer in a Box', which is
>>> a rack mounted NT machine that does multi-user display, has
>>> clustered reliability, and includes a really sweet RAID array. It
>>> supplies multi-user capability to Windows Terminals (and some X
>>> terminals), many of them, pretty much seamlessly. It's a really
>>> _great_ product.
>
>>I haven't heard of it, and I'm a little skeptical. Are you saying that
>>5, or fifteen, or fifty, or 500 people could run, say Word,
>>simultaneously on different displays?
>
>That's the deal, yep. They all run applications which are kept on
>the server; they don't have to have local storage.
Is it only me or does this sound exactly like the niche for which
Micro$oft develop(e?)s their Terminal Server (Codename Hydra)? I recently
read a test of the beta-version. Seems to work quite well so far. Of
course you need major processing power if several users want to work
with Word, Excel, Powerpoint or anything similar at the same time.
IIRC, the test found that a 200 MHz Pentium Server had a load of
80-90% while serving just _one_ user who scrolled through a Word
document.
Have a nice day
Juergen Puenter
------------------------------
Date: 18 May 1998 05:44:40 GMT
From: Robert Fields <robertf@shell5.ba.best.com>
Subject: Help Please: Perl for text substitution ?
Message-Id: <6johs8$aku$1@nntp1.ba.best.com>
A zillion thanks in advance to anyone who can help me !
I have a standard Unix mail file that contains an image link in each mail
message. The image link is a standard format such as:
<img src="http://www.mysite.com/image.jpg">
I need to bracket each occurance of the image link with <html></html> tags.
Each of the <html> tags need to be on their own line for processing that will
follow.
For example:
EACH OF OCCURANCE OF THIS:
<img src="http://www.mysite.com/image.jpg">
BECOMES THIS:
<HTML>
<img src="http://www.mysite.com/image.jpg">
</HTML>
A zillion thanks in advance for help !
------------------------------
Date: 18 May 1998 06:59:10 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Help Please: Perl for text substitution ?
Message-Id: <6jom7u$dcc$1@marina.cinenet.net>
Robert Fields (robertf@shell5.ba.best.com) wrote:
: I have a standard Unix mail file that contains an image link in each mail
: message. The image link is a standard format such as:
: <img src="http://www.mysite.com/image.jpg">
:
: I need to bracket each occurance of the image link with <html></html> tags.
: Each of the <html> tags need to be on their own line for processing that will
: follow.
:
: For example:
:
: EACH OF OCCURANCE OF THIS:
: <img src="http://www.mysite.com/image.jpg">
:
: BECOMES THIS:
: <HTML>
: <img src="http://www.mysite.com/image.jpg">
: </HTML>
If that image link really is a fixed text string, here's how I'd do it.
Assume the mail file is read from stdin and the modified version written
to stdout:
undef $/;
my $text = <>;
my $imgtag_re = quotemeta '<img src="http://www.mysite.com/image.jpg">';
$text =~ s!($imgtag_re)!\n<HTML>\n$1\n</HTML>\n!g;
print $text;
---------------------------------------------------------------------
| 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 05:03:18 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Install libnet module
Message-Id: <ebohlmanEt4zDI.AKD@netcom.com>
Francois <leurmy@akula.com> wrote:
: I'm trying to install the libnet module in my subdirectory on my ISP but
: I get an error message:
: parse error in file Makefille.PL at line 10, next 2 tokens "BEGIN {"
: parse error in file Makefille.PL at line 10, next 2 tokens "\MY: "
: Execution of Makefile.PL aborted due to compilation errors.
: Does anyone know how to fix that problem. My ISP is not very helpful.
: My ISP has Perl, Perl4 and Perl5 installedin the /usr/bin directory.
Those errors make it sound like Perl4 is the perl that's trying to
execute Makefile.PL. You need to somehow arrange for Perl5 to do it.
------------------------------
Date: 18 May 1998 00:14:25 -0400
From: mwmaurer@mtu.edu (Mark Maurer)
Subject: Re: Is if ($a="something") a bad style?
Message-Id: <6jocj1$ct$1@pace1.cts.mtu.edu>
Mark-Jason Dominus (mjd@op.net) wrote:
:
: In article <comdog-ya02408000R1705981924100001@news.panix.com>,
: brian d foy <comdog@computerdog.com> wrote:
:
: $i++ # increment $i
:
: It is not the job of the programmer to explain basic language
: semantics in the comments. Such comments are useless and take up
: valuable space. They are often confusing. If badly maintained (or
: badly written to begin with) they contradict the code, which creates
: problems for the maintenance programmer, who doesn't know whether to
: believe the code or the comment or neither. In this case, for
: example, you said `assign the reference in $dbh'. To me, this
: suggests that there is a reference in $dbh, and that you made an error
: in the code, writing $$dbh instead of $dbh.
:
: I suspect we are not going to agree on this. But my stance is that it
: is always useless to explain basic semantics in comments, because if
: the code is straightforward, it will speak for itself and an
: explanation is superfluous.
Not only that, but I sometimes get the notion into my head that if you can't
understand basic concepts of code, you have no business looking at it. Then
the real world hits me... :)
I just take a rather strong stance to most types of commenting, more than
likely as a backlash against the shit they taught my first year of college.
Crap like "you should have 1 line of comment for every 2 lines of code".
What utter bollocks. That just leads to the reviled "increment $i" comments
and their ilk. But that is what they wanted. That and the rule that you
could never use x, y, z, i, j, k for any variable names. Now I understand
about useful var names and all, but for a simple for loop, I am NOT going to
use $loopcount or its variations. I'll use $x and be done with it.
: Rob Pike says: ``If your code needs a comment to be understood, it
: would be better to rewrite it so it's easier to understand.'' I agree.
Same here...
--
Mark Maurer markm@dct.com mwmaurer@mtu.edu
Programmer, Digital Magic Interactive http://www.dminteractive.com
Senior, Michigan Technological University Houghton, MI
-- Views do not represent those of my employer or school
------------------------------
Date: Mon, 18 May 1998 04:26:10 GMT
From: phenix@interpath.com (John Moreno)
Subject: Re: Is if ($a="something") a bad style?
Message-Id: <1d975w1.xfp6mlhw8y0N@roxboro0-027.dyn.interpath.net>
Mark-Jason Dominus <mjd@op.net> wrote:
> if ((n = xpchk(z, i+k)) == 0) {
> ...
> }
A easy way to make stuff like that clear, write it like this:
if (0==(n = xpchk(z, i+k))) {
...
}
Do your comparisons with a constant first - then if you make a mistake
the compiler will flag it for you.
--
John Moreno
------------------------------
Date: 18 May 1998 05:10:32 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Is if ($a="something") a bad style?
Message-Id: <6jofs8$8os$1@marina.cinenet.net>
John Moreno (phenix@interpath.com) wrote:
: Mark-Jason Dominus <mjd@op.net> wrote:
:
: > if ((n = xpchk(z, i+k)) == 0) {
: > ...
: > }
:
: A easy way to make stuff like that clear, write it like this:
:
: if (0==(n = xpchk(z, i+k))) {
: ...
: }
:
: Do your comparisons with a constant first - then if you make a mistake
: the compiler will flag it for you.
That makes perfect sense logically, but I've *never* been able to get
myself to like it. Somehow, it seems to me that the 'important' stuff --
the things I need to think about most -- should come leftmost in an
expression. That's why I like Perl's postfix conditionals and looping
constructs so much. Putting a constant on the left just feels plain
wrong, unnatural; when reading it in other peoples' code, I always feel my
internal parser grinding to a halt and then backtracking to figure out
what's going on.
Of course, perhaps if I used this style for a time, it would come to feel
better to me. YMMV.
---------------------------------------------------------------------
| 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 05:14:33 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Jason Mclaughlin <mcjason@idirect.com>
Subject: Re: Looking for Perl TCP/IP Server Script
Message-Id: <Pine.GSO.3.96.980517221247.13837B-100000@user2.teleport.com>
On Sun, 17 May 1998, Jason Mclaughlin wrote:
> I've already tried all the example scripts in perlipc and asked in #perl
> on irc
> What I need is a Perl Script which WILL work with Activestate's Perl32.
If the example scripts aren't working for you, debug them and submit a
patch. Thanks!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 18 May 1998 05:54:58 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Nuclear bombing of NEW YORK! Small countries can target with nukes!
Message-Id: <6joifi$e9i$1@comdyn.comdyn.com.au>
In article <355F8AEC.E2380C21@comdyn.com.au.x>,
Anthony Mandic <no_sp.am@agd.nsw.gov.au> writes:
> Martien Verbruggen wrote:
>>
>> In article <3558CD29.12CB@yahoo.com>,
>> gdw <gdw@yahoo.com> writes:
>>
>> > "INDIA had developed GLOBAL Destruction weapon". What it means that -
>> > "Planet EARTH is NOT ONLY a HUGE bar magnet BUT also is a HUGE ATOM
>> > BOMB!!"
>>
>> Wow... And we could have known all this time. The spread of FRIDGE
>> MAGNETS should have shown us what was going on. After all!!! All
>> FRIDGES are made of ATOMS!!!!
[snip]
> I see that they're employing morons at the Trading Post now.
> Hey English, you brain is made up of atoms too. So don't
> think too hard or it might just explode.
Gosh.. It seems that people at the NSW gov don't understand sarcasm,
hmm? That explains a lot.
Martien
--
Martien Verbruggen | My friend has a baby. I'm writing down
Webmaster www.tradingpost.com.au | all the noises the baby makes so later
Commercial Dynamics Pty. Ltd. | I can ask him what he meant - Steven
NSW, Australia | Wright
------------------------------
Date: Mon, 18 May 1998 16:50:11 +1000
From: Anthony Mandic <no_sp.am@agd.nsw.gov.au.x>
Subject: Re: Nuclear bombing of NEW YORK! Small countries can target with nukes!
Message-Id: <355FDA23.2C3B4DEB@agd.nsw.gov.au.x>
Martien Verbruggen wrote:
> Gosh.. It seems that people at the NSW gov don't understand sarcasm,
> hmm? That explains a lot.
Sarcasm, is that what you're calling it now huh? Funny the
private email you sent me showed me that you were shitscared
about something English. What's the matter? Worried that
Roderick might find out what you get up to on the net?
-am
------------------------------
Date: 18 May 1998 03:21:16 -0400
From: viro@steklov.math.psu.edu (Alexander Viro)
Subject: Re: Nuclear bombing of NEW YORK! Small countries can target with nukes!
Message-Id: <6jonhc$54e@steklov.math.psu.edu>
In article <355FDA23.2C3B4DEB@agd.nsw.gov.au.x>,
Anthony Mandic <no_sp.am@agd.nsw.gov.au.x> wrote:
[snip]
> Sarcasm, is that what you're calling it now huh? Funny the
> private email you sent me showed me that you were shitscared
> about something English. What's the matter? Worried that
> Roderick might find out what you get up to on the net?
Gentlemen, may I ask you to take this extremely interesting discussion
about your private email to the place where it belongs? That is, away
from USENET. OK?
Al
--
My theory is that someone's Emacs crashed on a very early version of Linux
while reading alt.flame and the resulting unholy combination of Elisp and
Minix code somehow managed to bootstrap itself and take on an independent
existence. -- James Raynard in c.u.b.f.m on nature of Albert Cahalan
------------------------------
Date: Mon, 18 May 1998 05:22:12 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Sam Brodkin <sammy.brodkin@sun.com>
Subject: Re: perl binary with libraries included
Message-Id: <Pine.GSO.3.96.980517221620.13837C-100000@user2.teleport.com>
On Mon, 11 May 1998, Sam Brodkin wrote:
> Is it possible to compile perl with the libraries included (so that you
> don't have to have a libraries directory?)
It's not just possible, it's also pointless. :-)
It's possible to statically link all of the libraries, but doing so
wouldn't eliminate the need for @INC directories; you would still need to
have some pragmas and modules to have Perl. You would even be giving up
all of the advantages of dynamic linking! But if you really want to do
this, simply compile without dynamic linking.
Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 18 May 1998 09:31:03 +0200
From: Koenich <ruediger@perl.pl>
Subject: Re: Quick Question about Perl TCP/IP
Message-Id: <355FE3B7.5011C129@perl.pl>
Jason Mclaughlin wrote:
> I was wondering if anyone knew how I could write a small Perl script to
> listen on a TCP port and when Someone connects send some text to them
> then disconnect, Kinna like a small server, Thanks
>
It is very easy if you let do inetd the dirty job for you. You can
assign a
own port address in /etc/services and insert your skript into the
inetd.conf.
On connect inetd will execute your script and he ties the input and output
from the network stream to your STDIN and STDOUT.
I
best regards,
ruedi
------------------------------
Date: Mon, 18 May 1998 01:13:12 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Regex problem: substituting 3+ identical characters with just one
Message-Id: <1d978vm.bo38qq12aevtsN@bay1-128.quincy.ziplink.net>
Ala Qumsieh <aqumsieh@matrox.com> wrote:
> > Now enter Perl. I use a regex to subtitute each occurence of 3 or more
> > identical characters with just one character. [...]
> > s/([a-zA-Z0-9])\1\1+/\1/g
That substitution squashes repetions of three or more of the same
character.
> Woooooo!! Why so complicated? Keep in mind that Perl is synonymous with
> laziness! ;-)
>
> You probably need:
> tr/a-zA-Z0-9//s;
That transformation squahes repetitions of *two* or more of the same
character. Not what the original poster wants.
Laziness is good, but not as important as correctness. ;-)
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 18 May 1998 06:04:12 GMT
From: Juergen.Puenter@materna.de (J|rgen P|nter)
Subject: Re: Regex problem: substituting 3+ identical characters with just one
Message-Id: <6joj0s$rav$3@penthesilea.Materna.DE>
In article <355CA94C.6E515454@matrox.com>, aqumsieh@matrox.com says...
>
>J|rgen P|nter wrote:
>
>> Now enter Perl. I use a regex to subtitute each occurence of 3 or more
>> identical characters with just one character. Being a learner, the regex is
>> very simple:
>> s/([a-zA-Z0-9])\1\1+/\1/g
>
>Woooooo!! Why so complicated? Keep in mind that Perl is synonymous with laziness
>!
>;-)
>
>You probably need:
> tr/a-zA-Z0-9//s;
Interesting. I never thought about using tr. But this would turn e.g.
'command' into 'comand', thus stripping perfectly valid doubles. At
least for me it does. Looks like you got a bit too lazy here ;-))
>> Now the obvious problem is that my regex goes wrong if e.g. 'Page 22' turns
>> into 'Page 22222' and will thus read 'Page 2' after substitution.
>
>Yep ... that's a problem. I don't really see an easy solution for this! Unless .
>.
>the characters repeat in some defined fashion.
Yes, it is a somewhat defined fashion, but the problem has become moot
anyway. I already got several tips how to avoid the problem altogether.
It was just a case of terminal dumbness. It didn't recognize the for-
matting commands and thus produced garbage. A simple pipe to 'col -b'
solved this easily.
Thanks for your help anyway.
Have a nice day
Juergen Puenter
------------------------------
Date: Mon, 18 May 1998 01:13:14 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: REGEX Question
Message-Id: <1d9792t.r3rin76fco7jN@bay1-128.quincy.ziplink.net>
Robert Boyd Skipper <rbskipper@wimberley-tx.com> wrote:
> (\S*){1,3} asks for any number (perhaps none) of non-space characters, and
> between one and three such matches. This is satisfied by "(T)(w)(i)ce."
Technically, it would actually match "(Twice)()()", due to the
greediness of *.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 18 May 1998 08:56:21 GMT
From: tina@scandinaviaonline.se (Tina Marie Holmboe)
Subject: Re: sending regex matches to a separate file
Message-Id: <6jot3l$1fi$1@news1.sol.no>
In article <355EF23D.5B63@datahost.com>,
Michael Stearns <michael@datahost.com> writes:
> How do I write a regex that takes each matching item and sticks it in a
> separated variable (or maybe I should be putting them in an array?)
What you have above is really a very good description of what you need
to do.
1) Read the text,
2) Parse out URLs,
3) Write these to a new file.
Note: parsing URLs out of text is a *tough* job - you might want to check
CPAN for modules that'll make this job easier. However...
foreach (@ARGV) {
open (INFILE,"$_") || die ("Can't Open $_\n") ;
@text=<INFILE> ;
$text=join("",@text) ;
print "$text\n";
while ($text=~s/(http:\/\/.*?)">/$1/) {
$text2=$text2.$1\n;
}
close (INFILE);
open (OUTFILE,">list.txt") || die ("Can't Open $_\n");
print OUTFILE ($text2);
}
Firstly; as you have yourself noted, <INFILE> returns a list containing
the content of the file split on the default record separator. That
means you can do:
# I'll my() this to avoid any fun
# sideeffects of scope.
my($test) = join('', <INFILE>) ;
Thereafter you can take advantage of the fact that matching regexp's can
return lists:
# i : case insensitive
# g: global
my(@URLs) = ( $text =~ m%
( # Grouping (start)
http:// # URL start with "http://"
[^>"]+ # One, or more, characters != > || "
) # Grouping (end)
"? # Possibly one "
> # End with a '>'
%igx ) ;
After this the @URLs array should hold *some* of the URLs in the text. This
does take into account ftp://, mailto://, news:// etc, etc, etc.
Helpful ?
--
Tina Marie Holmboe
Application Developer (Geeks'R'Us) [tina@tech.scandinaviaonline.se]
Scandinavia Online AB Development Dept. (+46) 08 587 81000 (switchboard)
(+46) 08 587 81189 (direct)
------------------------------
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 2625
**************************************