[7165] in Perl-Users-Digest
Perl-Users Digest, Issue: 790 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 29 13:35:34 1997
Date: Tue, 29 Jul 97 10:00:24 -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 Tue, 29 Jul 1997 Volume: 8 Number: 790
Today's topics:
About DB_File! (Ari Pekka Niinimdki)
Re: About DB_File! (Paul Marquess)
Re: asynchronous processing using Perl and Sybperl <selden@NOSPAM.instinet.com>
Re: CGI server internal error (Clay Irving)
Re: Checking for valid Email... <jacksodp@dragon.ham.muohio.edu>
comment (John Liao)
Re: Create E-mail with perl-script <jamesc@geoaccess.com>
File locking <manowitz@mit.edu>
Re: GZIP, TAR question <pociask@maricopa.edu>
Help...I am new to Perl <herman1@pacific.net.sg>
Re: HELP: perl 5.001 WinNT (Parillo)
Re: How to print multiple images <rootbeer@teleport.com>
Re: interesting sorting problem (Andrew M. Langmead)
Need help on fork FAQ <nichori@cat.com>
open a url <jigonzalez@readysoft.es>
Opposite of ord <chris@cybertech.com.sg>
Re: Opposite of ord <sfairey@adc.metrica.co.uk>
Re: Opposite of ord <eike.grote@theo.phy.uni-bayreuth.de>
Re: Perl behavior on Win32 vs Unix (Scott McMahan)
Re: PERL on MS Internet Information Server (Danny Aldham)
Re: PERL on MS Internet Information Server (Parillo)
Re: PERL on MS Internet Information Server (Tim Gray)
Re: perl on Win32 - fork() (Scott McMahan)
Re: posix ???? <rootbeer@teleport.com>
regexp problem <matte@spud.lonelyplanet.com.au>
Re: regexp problem (Pete Jordan)
Regexp (J.Hernetkoski)
Re: Regexp <eike.grote@theo.phy.uni-bayreuth.de>
Re: Regular Expressions with metacharacters <rootbeer@teleport.com>
Re: Unix time, local time, year 2000 question. (Paddy Spencer)
win-nt, perl, & aol (KCoughln)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 29 Jul 1997 14:22:06 GMT
From: e74632@majakka.uwasa.fi (Ari Pekka Niinimdki)
Subject: About DB_File!
Message-Id: <5rkuae$gbh@verkko.cc.uwasa.fi>
Can I store "hash of hashes" into the DB-database?
I tryed this:
$DB{'1'}{person} = "john";
$DB{'1'}{room} = "D632";
And when I reopen the database and try to read like this:
print "$D{'1'}{person}\n";
I get this error message:
Use of uninitialized value at myprogram line ...
What is wrong?
Is there any alternative way to do this?
--
---------------------------------------------------------
Ari Niinimaki Hauentie 25 B16
ATK-keskus 65200 VAASA
e74632@uwasa.fi koti: 0500 860 175
tyo : 3248 387
---------------------------------------------------------
------------------------------
Date: 29 Jul 1997 14:59:30 GMT
From: pmarquess@bfsec.bt.co.uk (Paul Marquess)
Subject: Re: About DB_File!
Message-Id: <5rl0gi$6ip$1@pheidippides.axion.bt.co.uk>
[ Posted & Mailed ]
Ari Pekka Niinimdki (e74632@majakka.uwasa.fi) wrote:
: Can I store "hash of hashes" into the DB-database?
: I tryed this:
: $DB{'1'}{person} = "john";
: $DB{'1'}{room} = "D632";
: And when I reopen the database and try to read like this:
: print "$D{'1'}{person}\n";
: I get this error message:
: Use of uninitialized value at myprogram line ...
: What is wrong?
: Is there any alternative way to do this?
>From the documentation that comes with DB_File:
How do I store complex data structures with DB_File?
Although DB_File cannot do this directly, there is a module which
can layer transparently over DB_File to accomplish this feat.
Check out the MLDBM module, available on CPAN in the directory
modules/by-module/MLDBM.
Paul
------------------------------
Date: Tue, 29 Jul 1997 09:17:28 -0400
From: Michael Shael O'Neill Selden <selden@NOSPAM.instinet.com>
Subject: Re: asynchronous processing using Perl and Sybperl
Message-Id: <33DDED68.7531@NOSPAM.instinet.com>
Lee Falkenhagen wrote:
>
> I need to do some asynchronous processing using Perl and sybPerl. Any
> ideas on how to do this using Perl 4.036 and Sybperl 1.9? I have a SMP
> machine and right now, Sybase is only processing one request at a time. I
> would like to give the other CPUs some work to do.
>
> It would require kicking off several functions that I wrote that are the
> basis for other work. When these functions are finished, several other
> dependent functions then need to be called for each of the first functions.
> I can not include the calls in the original function because the business
> rules will change over time and the dependent functions are only called in
> certain circumstances.
>
> Thanks
> --
> Lee Falkenhagen
> Certified Sybase DBA
> falkenl@crl.com
Lee,
Please post additional information regarding
your environment (OS & DBMS versions, etc.) and what
it is that you are trying to do. I would recommend
that you upgrade your Perl to version 5.004_n and your
Sybperl to at least version 2.07, the versions with
which you are working are quite limiting as compared
to what is currently available.
Michael.
--
Michael Shael O'Neill Selden
selden@instinet.com
Remove "NOSPAM." From Address To Return Mail
PGP Public Key Available Upon Request
------------------------------
Date: 29 Jul 1997 09:10:12 -0400
From: clay@panix.com (Clay Irving)
Subject: Re: CGI server internal error
Message-Id: <5rkq3k$l5h@panix.com>
In <33DD224A.371C@non-hp-paloalto-om15.om.hp.com> PAUL YAN <PAUL_YAN@non-hp-paloalto-om15.om.hp.com> writes:
[...]
>sub printHTMLheader {
> print 'Content-type: text/html';
> print "\n";
> print '<HTML>';
> print "\n";
> print '<BODY BGCOLOR="#FFFFFF" text="#000000">';
> print "\n";
>}
[...]
>What is wrong with it ? I need a hand !
Actually, you need another newline after the "Content-type" statement.
--
Clay Irving <clay@panix.com> http://www.panix.com/~clay/
------------------------------
Date: 29 Jul 97 08:47:58 -0500
From: Dane P. Jackson <jacksodp@dragon.ham.muohio.edu>
Subject: Re: Checking for valid Email...
Message-Id: <1997Jul29.084758.6021@nntp.muohio.edu>
I'm sorry, but a lot of the traffic about theis discussion is downright silly.
I think that simply to cut down on the bandwidth you have to wade through people should
be courteous and try and figure out answers to simple questions themselves. I've
only been coding in perl for 2-3 weeks, I'm no guru. I just picked up one of the books
on it and starting programming. I try to find my own answers first in reference books
on hand, then I look on CPAN or www.perl.com or something like that. Only if I can't
find what I need in these places do I post a question. Let's face it's basic courtesy
to try and answer the question yoself before you post.
--
Dane Jackson - jacksodp@dragon.ham.muohio.edu
"Never date a woman with a brother named Nunzio."
-Walter Slovotsky's Law #22
------------------------------
Date: 29 Jul 1997 14:46:04 GMT
From: johnliao@cs.buffalo.edu (John Liao)
Subject: comment
Message-Id: <5rkvnc$kgr@prometheus.acsu.buffalo.edu>
Is there a equivalent /* */ for comments in perl?
Thanks
--
_/ _/ _/ _/
_/_/ _/_/_/ _/_/_/ _/ _/_/_/ _/_/
_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
------------------------------
Date: 29 Jul 1997 15:17:30 GMT
From: "james" <jamesc@geoaccess.com>
Subject: Re: Create E-mail with perl-script
Message-Id: <01bc9c32$2d2aaa80$240a010a@choljam>
I believe it's your e-mail software that has the problem. It will simply
display the HTML tags, not interpret them.
Laurijssen Dirk <laurijsd@se.bel.alcatel.be> wrote in article
<33DDF96F.2588@se.bel.alcatel.be.brol>...
> I'm trying to send a message upon pushing a "send" button on a
> HTML-page.
> For now I use a perl-script to do so.
> The problem is that I write HTML-statements to the message but when I
> receive the message these statements aren't processed. (The tags stay
> visible).
> In order to do so I could try to convince the Mail-tool that these
> statements are attached, but how ? Any other (Javascript/Perl)solutions
> ?
>
> Kind regards,
> Dirk L.
>
------------------------------
Date: Mon, 28 Jul 1997 21:12:29 -0400
From: David Manowitz <manowitz@mit.edu>
Subject: File locking
Message-Id: <33DD437D.40F3@mit.edu>
I am writing a Perl script to be run as a CGI program. As a result, I
have a question about locking files in Perl. In one place (I forget
where), it seemed to indicate that Perl should automatically lock files
upon opening them. However, I have not been able to confirm this
statement elsewhere. Is the statement true, and if not, how would one
go about locking files on a UNIX system (NetBSD)?
Thank you,
David Manowitz
manowitz@mit.edu
------------------------------
Date: Tue, 29 Jul 1997 00:59:15 -0600
From: Jason Pociask <pociask@maricopa.edu>
Subject: Re: GZIP, TAR question
Message-Id: <33DD94C3.F66@maricopa.edu>
Correction:
> Is there some way to fix that with the usual Win32 implementations
> of "tar"? I think I got mine off ftp://ftp.gnu.ai.mit.edu/pub/gnu/.
Sorry, the tar is from:
ftp://ftp.cs.washington.edu/pub/ntemacs/utilities/i386/
------------------------------
Date: 29 Jul 1997 08:18:44 GMT
From: "Gecko_Lim" <herman1@pacific.net.sg>
Subject: Help...I am new to Perl
Message-Id: <01bc9c74$f672f680$255c18d2@gecko>
I am trying to learn something abt perl.
First of all, do I need to install something into my PC, (its a win95) be4
I can test out.
I am told "perl" people are really nice. So a big thank you first.
------------------------------
Date: 29 Jul 1997 12:03:05 GMT
From: lparillo@newshost.li.net (Parillo)
Subject: Re: HELP: perl 5.001 WinNT
Message-Id: <5rkm5p$2c6$1@news01.li.net>
If this fails when running on a web server, it could be directory
permissions.
lparillo at suffolk dot lib dot ny dot us
Leonid Lamburt (leonid@cs.bu.edu) wrote:
: I am trying to get the list of files in some directory:
: The following doesn't work, even though I can execute the command
: from the command prompt:
: $files = `dir c:\somedir /B`;
: print $files;
: What am I doing wrong?
: (If nothing, is there any work around ?)
------------------------------
Date: Mon, 28 Jul 1997 19:31:05 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: grebeint@singnet.com.sg
Subject: Re: How to print multiple images
Message-Id: <Pine.GSO.3.96.970728192801.6224N-100000@kelly.teleport.com>
On Mon, 28 Jul 1997 grebeint@singnet.com.sg wrote:
> I have 10 gif files from 0..9gifs files all have the same size and
> pattern kind of numbers.
> What I cannot do now is to use Perl to write 2 or more numbers back to
> the calling HTML. But I can print back one gif image!
You want to be able to merge two (or more) images to make a new graphic.
Fortunately, this is easy to do with Perl. :-) Take a look at how Randal
does it in his 13th Web Techniques column, and you'll be on your way. Good
luck!
http://www.stonehenge.com/merlyn/WebTechniques/
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 28 Jul 1997 23:23:43 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: interesting sorting problem
Message-Id: <EE1yBJ.2qq@world.std.com>
Craig Ciquera <craig@mathworks.com> writes:
>So basically, I would like to sort on all '.' separated fields and have
>the output appear in ascending order.
One thing to consider is that a dotted quad IP address can also be
viewed as a single 32 bit number. (and is really treated that why by
the operating systems network code) If you convert each IP address
into its "real" form, then can be done with just a numeric comparison.
When you have to convert your data before you sort, you usually have a
more efficient sort if you do all the converting in one step.
use Socket;
for $dottedquad (@addresses) {
# each $addresses[ has a corresponding $addr32bit[n]
push @addr32bit, inet_aton $dottedquad;
}
@addresses = @addresses[ sort by_raw_address 0 .. $#addresses ];
sub by_raw_address {
# $a and $b are indicies to the array we are tring to sort.
$addr32bit[$a] <=> $addr32bit[$b];
}
If you don't like that, you can make an array of each section of the
dotted quad, and sort on each one in turn. If you do this, one thing
to keep in mind is the usefulness of the short circuiting property of
the or operator. If the "or" operators first term is true, that term
is the result, otherwise it is the second term. You can string a bunch
of "or" expressions together to find the first expression which is
true.
for $dottedquad (@addresses) {
push @brokenupaddress, [ split /\./, $dottedquad ];
}
@addresses = @addresses[ sort by_quad_section 0 .. $#addresses ];
sub by_quad_section {
$brokenupaddress[$a][0] <=> $borkenupaddress[$b][0] or
$brokenupaddress[$a][1] <=> $borkenupaddress[$b][1] or
$brokenupaddress[$a][2] <=> $borkenupaddress[$b][2] or
$brokenupaddress[$a][3] <=> $borkenupaddress[$b][3];
}
For more information, take a look at the FAQ entry "How do I sort an
array by (anything)?" <URL:http://www.perl.com/CPAN/doc/manual/html/
pod/perlfaq4/How_do_I_sort_an_aray_by_anyth.html> or the article "Far
More Than Everything You Ever Wanted to Know About Sorting" <URL:
http://www.perl.com/CPAN/doc/FMTEYEWTK/sorting.html>
--
Andrew Langmead
------------------------------
Date: Tue, 29 Jul 1997 09:53:38 -0500
From: "Rowland I. Nicholson" <nichori@cat.com>
Subject: Need help on fork FAQ
Message-Id: <33DE03F2.49FA@cat.com>
I'm trying to launch an application, which takes 4 minutes to run,
without the browser having to wait for it to finish. I found the
following from the FAQ at:
ftp://ftp.dti.ad.jp/pub/lang/CPAN/doc/manual/html/pod/perlfaq8/How_do_I_fork_a_daemon_proces_.html
>How do I fork a daemon process?
>
>If by daemon process you mean one that's detached (disassociated from its tty), then the following process is reported to work on most
>Unixish systems. Non-Unix users should check their Your_OS::Process module for other solutions.
>
> * Open /dev/tty and use the the TIOCNOTTY ioctl on it. See tty(4) for details.
>
> * Change directory to /
>
> * Reopen STDIN, STDOUT, and STDERR so they're not connected to the old tty.
>
> * Background yourself like this:
>
> fork && exit;
I've experimented with this but have not gotten it to work yet. Has
anyone
got some code that works (launches the application and closes the
browser
connection without waiting). Thanks in advance.
Rowland
------------------------------
Date: Tue, 29 Jul 1997 11:52:05 +0200
From: Jose Ignacio <jigonzalez@readysoft.es>
Subject: open a url
Message-Id: <33DDBD45.A81974C2@readysoft.es>
First pardon about my english. i don't speak english very well
I have the next problem, I don't know how to open a url for reading. I
try open (FILE, "http://www.xxxxx.com/gg.htm) but this don't work.
This open (FILE, "gg.htm") work ok but the other no.
How can i open an URL like http://www.xxxxxx.com/gg.htm ??
Please e-mail me to jigonzalez@readysoft.es
Thanks to all
Regards
Jose Ignacio
------------------------------
Date: Tue, 29 Jul 1997 18:44:02 +0800
From: Christopher Chan <chris@cybertech.com.sg>
Subject: Opposite of ord
Message-Id: <33DDC972.5AFB@cybertech.com.sg>
ord converts a alphabet to ascii. Is there a function to do the
reverse? Thank you.
--
Christopher Chan
------------------------------
Date: Tue, 29 Jul 1997 12:04:15 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
To: Christopher Chan <chris@cybertech.com.sg>
Subject: Re: Opposite of ord
Message-Id: <33DDCE2E.97E4166F@adc.metrica.co.uk>
Christopher Chan wrote:
> ord converts a alphabet to ascii. Is there a function to do the
> reverse? Thank you.
>
> --
> Christopher Chan
Look at the perlfunc manpage for the chr() function.
Simon
------------------------------
Date: Tue, 29 Jul 1997 15:12:13 +0200
From: Eike Grote <eike.grote@theo.phy.uni-bayreuth.de>
Subject: Re: Opposite of ord
Message-Id: <33DDEC2D.446B@theo.phy.uni-bayreuth.de>
Hi,
Christopher Chan wrote:
>
> ord converts a alphabet to ascii. Is there a function to do the
> reverse? Thank you.
There is 'chr()': 'chr(65)' is equal to 'A', for example
Bye, Eike
--
======================================================================
Eike Grote, Theoretical Physics IV, University of Bayreuth, Germany
----------------------------------------------------------------------
e-mail -> eike.grote@theo.phy.uni-bayreuth.de
WWW -> http://www.phy.uni-bayreuth.de/theo/tp4/members/grote.html
http://www.phy.uni-bayreuth.de/~btpa25/
======================================================================
------------------------------
Date: 29 Jul 1997 12:57:47 GMT
From: scott@lighthouse.softbase.com (Scott McMahan)
Subject: Re: Perl behavior on Win32 vs Unix
Message-Id: <5rkpcb$r5n$2@mainsrv.main.nc.us>
John Yang (hjy2@cornell.edu) wrote:
: system ("cp $PATH_TO_MASTER/cgi/* $PATH_TO_COURSE_CGI/");
: # system ("copy c:/inetpub/wwwroot/master/cgi/*
: c:/inetpub/scripts/courses/nttest/");
: The first line is the one we used for the unix machine, the bottom line
: is what I think it should be for the WinNT machine. It does not seem to
: work.
Remember copy is built into the command interpreter. system doesn't
use the command interpreter. Either use xcopy, a real program, or
cmd /c in front of copy.
Scott
------------------------------
Date: 28 Jul 1997 23:20:04 -0700
From: danny@lennon.postino.com (Danny Aldham)
Subject: Re: PERL on MS Internet Information Server
Message-Id: <5rk22k$emg$1@lennon.postino.com>
ALTA RESEARCH (alta@tab.com) wrote:
: We are in the process of configuring PERL (CGI) on the MS Internet
: Information Server.
: There is very little documentation, either from Microsoft or on the WWW.
: Has anyone come across a good information resource?
: This seems like a very heavy handed action by Microsoft. Are they trying
: to limit support for PERL in an attempt to force everyone into ActiveX and
: Visual Basic?
Don't know where you have looked, but Microsoft provide more official
perl support that most vendors. On page 170 of the Internet Guide from
the NT Server Resource Kit is a description of how to configure perl
cgi scripts. There is also a great article in the Technet KB , do a
search on Perl.
--
Danny Aldham SCO Ace , MCSE , JAPH , DAD
I don't need to hide my e-mail address, I broke my sendmail.
------------------------------
Date: 29 Jul 1997 12:16:26 GMT
From: lparillo@newshost.li.net (Parillo)
Subject: Re: PERL on MS Internet Information Server
Message-Id: <5rkmuq$2c6$2@news01.li.net>
Try: http://www.endcontsw.com/people/evangelo/Perl_for_Win32_FAQ.html
and: http://www.microsoft.com/kb/articles/q150/6/29.htm
lparillo at suffolk dot lib dot ny dot us
ALTA RESEARCH (alta@tab.com) wrote:
: We are in the process of configuring PERL (CGI) on the MS Internet
: Information Server.
: There is very little documentation, either from Microsoft or on the WWW.
: Has anyone come across a good information resource?
: Please help.
: This seems like a very heavy handed action by Microsoft. Are they trying
: to limit support for PERL in an attempt to force everyone into ActiveX and
: Visual Basic?
------------------------------
Date: 29 Jul 1997 07:54:56 -0400
From: tim@hcirisc.cs.binghamton.edu (Tim Gray)
To: "ALTA RESEARCH" <alta@tab.com>
Subject: Re: PERL on MS Internet Information Server
Message-Id: <t0wwma844v.fsf@hcirisc.cs.binghamton.edu>
"ALTA RESEARCH" <alta@tab.com> writes:
>We are in the process of configuring PERL (CGI) on the MS Internet
>Information Server.
>
>There is very little documentation, either from Microsoft or on the WWW.
>
>Has anyone come across a good information resource?
>
>Please help.
>
>This seems like a very heavy handed action by Microsoft. Are they trying
>to limit support for PERL in an attempt to force everyone into ActiveX and
>Visual Basic?
Microsoft doesn't play nice with anyone, especially not anything that
is free and more useful than its products like PERL.
There should be a batch file that comes with the distribution of the
ISAPI version of perl that installs the right registry entries etc.
Check http://www.activeware.com for the latest version.
------------------------------
Date: 29 Jul 1997 12:59:26 GMT
From: scott@lighthouse.softbase.com (Scott McMahan)
Subject: Re: perl on Win32 - fork()
Message-Id: <5rkpfe$r5n$3@mainsrv.main.nc.us>
Andrew Cheyne (stud6x19@bnr.ca) wrote:
: I am porting a Unix perl script to perl for Win32 and keep
: getting an error message stating that fork is unspoorted. IS
: this true? Is it available anywhere else?
Thanks to Windows NT's VMS origins, it uses the VMS process
model, not the UNIX one. Forking as we know it in UNIX is
impossible. Windows NT uses threads where UNIX would use
processes. Since there are no multithreading packages
for Win32 Perl that I know of, you're out of luck.
Scott
------------------------------
Date: Tue, 29 Jul 1997 07:57:05 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Burt Lewis <burt@ici.net>
Subject: Re: posix ????
Message-Id: <Pine.GSO.3.96.970729075549.21501O-100000@kelly.teleport.com>
On 27 Jul 1997, Burt Lewis wrote:
> I'm trying to do this:
>
> use POSIX strftime;
> print strftime("%I:%M %p", localtime), "\n";
>
> and get this error when run from the shell,
> Can't locate POSISX.pm in @INC at notes1.pl line 140.
That looks like Perl has found the problem. Do you have any idea why Perl
might be having troubles finding "POSISX"? :-) Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 29 Jul 1997 20:58:41 +1000
From: Matt Eckhaus <matte@spud.lonelyplanet.com.au>
Subject: regexp problem
Message-Id: <33DDCCE1.564C33D0@spud.lonelyplanet.com.au>
I need a script that strips all the html out of a file. So I tried
using Tom Christiansen's striphtml script
(http://www.perl.com/perl/scripts/html-hacking.html).
It contains this substitution (I've removed the comments and
whitespace):
s{<(?:[^>'"]*|".*?"|'.*?')+>}{}gsx;
But when I run it, I get this error message from perl:
regexp *+ operand could be empty
Can anyone explain to me what this means? I can't see what's wrong with
the expression.
Thanks,
Matt.
------------------------------
Date: Tue, 29 Jul 1997 13:54:31 GMT
From: pete@horus.cix.vapethis.co.uk (Pete Jordan)
Subject: Re: regexp problem
Message-Id: <memo.19970729145431.17533C@horus.cix.co.uk>
In article <33DDCCE1.564C33D0@spud.lonelyplanet.com.au>,
matte@spud.lonelyplanet.com.au (Matt Eckhaus) wrote:
> It contains this substitution (I've removed the comments and
> whitespace):
>
> s{<(?:[^>'"]*|".*?"|'.*?')+>}{}gsx;
>
> But when I run it, I get this error message from perl:
>
> regexp *+ operand could be empty
Well, it's right. What you've essentially got there is /(a|b|c)+/, which is
fine as long as (a|b|c) can't evaluate to an empty pattern; trouble is, 'a'
([^>'"]*) /can/ evaluate to an empty string. How on Earth is perl supposed
to interpret one or more occurrences of nothing? Why should Perl ever check
'b' or 'c' if 'a' /always/ matches?
You can fix it thus:
s{<(?:[^>'"]+|".*?"|'.*?')*>}{}gsx;
Pete Jordan
= = = = = = = = = = = = = = = = = = = = = = =
Horus Communications
http://www.horus.cix.co.uk/
= = = = = = = = = = = = = = = = = = = = = = =
"As soon as we have defined something, we have ipso
facto created three things: whatever is included in
our definition, whatever is not included in our
definition, and the relationship between them."
------------------------------
Date: 29 Jul 1997 06:37:45 GMT
From: jjjj@zenith.yok.utu.fi (J.Hernetkoski)
Subject: Regexp
Message-Id: <5rk33p$7rp$1@news.utu.fi>
How would I change all lines that contains
<a href="/something.html">
to
<a href="http://my.server.com/something.html"> ?
There are many different links so
s/(<A HREF=\"\/home.html\">)/<A HREF=\"http:\/\/my.server.com\/home.html\">/g;
won't do the job.
I tried this:
foreach (@results) { # @results contains an html-page
s/(<A HREF=\".*\">)/<A HREF=\"http:\/\/my.server.com\/$1\">/g;
}
with no luck.
A little help would be greatly appreciated.
--
Jukka
------------------------------
Date: Tue, 29 Jul 1997 13:33:31 +0200
From: Eike Grote <eike.grote@theo.phy.uni-bayreuth.de>
Subject: Re: Regexp
Message-Id: <33DDD50B.2781@theo.phy.uni-bayreuth.de>
Hi,
J.Hernetkoski wrote:
>
> How would I change all lines that contains
>
> <a href="/something.html">
>
> to
>
> <a href="http://my.server.com/something.html"> ?
>
> I tried this:
>
> foreach (@results) { # @results contains an html-page
>
> s/(<A HREF=\".*\">)/<A HREF=\"http:\/\/my.server.com\/$1\">/g;
>
> }
>
> with no luck.
Try this one:
foreach (@results) {
s/<A HREF=\"(.*?)\">/<A HREF=\"http:\/\/my.server.com\/$1\">/g;
}
A few notes:
(1) You put the parens in the search pattern at the wrong place
(maybe just a typo ...)
(2) Insert the question mark '?' in the search pattern - otherwise
you might match several links in one pattern (including all
the text in between) -> see also my posting 'Re: regexp problems :('
(3) If '@results' contains an HTML file line by line, you will be
out of luck if a tag begins in one line and ends in another (allowed
by HTML). Then you might try to convert the array '@result' into
one single string (using 'join', for example).
(4) Using your example above you will get two slashes after the
replacement (between 'my.server.com' and 'something.html') - if
that matters to you, remove the one after 'com' in the replace part.
Bye, Eike
--
======================================================================
Eike Grote, Theoretical Physics IV, University of Bayreuth, Germany
----------------------------------------------------------------------
e-mail -> eike.grote@theo.phy.uni-bayreuth.de
WWW -> http://www.phy.uni-bayreuth.de/theo/tp4/members/grote.html
http://www.phy.uni-bayreuth.de/~btpa25/
======================================================================
------------------------------
Date: Mon, 28 Jul 1997 19:46:00 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: pdxjobs@pdxjobs.com
Subject: Re: Regular Expressions with metacharacters
Message-Id: <Pine.GSO.3.96.970728194413.6224P-100000@kelly.teleport.com>
On Tue, 29 Jul 1997 pdxjobs@pdxjobs.com wrote:
> $RE="c++";
> @lines=("line a", "line b c++ d", "line e f g");
> @match=grep /\s\Q$RE\s/i, @lines;
Remember that \Q quotes all the metacharacters which follow, so the
regular expression is now this.
/\sc\+\+\\s/i
That's not what you wanted! You want \E, and maybe /o as well. Hope this
helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 29 Jul 1997 09:58:20 GMT
From: paddy.spencer@parallax.co.uk (Paddy Spencer)
Subject: Re: Unix time, local time, year 2000 question.
Message-Id: <870170115.706519@red.parallax.co.uk>
michal@gortel.phys.ualberta.ca (Michal Jaegermann) kirjoittanut::
: Randal Schwartz (merlyn@stonehenge.com) wrote:
: :
: : $ perl -e 'print scalar gmtime 1 << 31'
: : Fri Dec 13 20:45:52 1901
: :
: : Hmm. That's not what I wanted. And look, it's a Friday the 13th. :-)
: It depends a bit on a platform.
: $ perl -e 'print scalar gmtime (1 << 31), "\n"'
: Tue Jan 19 03:14:08 2038
It does indeed:
C:\>perl -we 'print scalar gmtime (1 << 31)'
File not found
C:\>perl -we "print scalar gmtime (1 << 31)"
Use of uninitialized value at -e line 1.
That's Win95 for you I guess...
--
Paddy Spencer Parallax Solutions Ltd (http://www.parallax.co.uk/)
"The mutant wasn't doing too well, and had started to melt. But I'd had
it up to here and pretended not to notice."
-- Moebius, The Incal, book one.
------------------------------
Date: 29 Jul 1997 02:43:33 GMT
From: kcoughln@aol.com (KCoughln)
Subject: win-nt, perl, & aol
Message-Id: <19970729024301.WAA00403@ladder02.news.aol.com>
Having problem figuring this one out. Am using newest version of win nt
and using netscape or ie am not experiencing problem. However using aol I
execute my script and receive message http://customer.genesys-sofPOST
which does not even include my entire site name. Have a button on main
site, click on the button which is the INPUT to the form on a secure site.
Hope this is enough info. Can anyone help?
------------------------------
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 790
*************************************