[24301] in Perl-Users-Digest
Perl-Users Digest, Issue: 6492 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 30 14:05:50 2004
Date: Fri, 30 Apr 2004 11:05:09 -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 Fri, 30 Apr 2004 Volume: 10 Number: 6492
Today's topics:
4 Perl books for sale at auction <anon@no-domain.com>
Re: another thing <uri.guttman@fmr.com>
Re: cywin versus activestate on xp <bik.mido@tiscalinet.it>
Re: cywin versus activestate on xp <dwall@fastmail.fm>
Re: cywin versus activestate on xp <digbygroks@verizon.net>
excel file <anonymous@disneyland.com>
Re: excel file <mark.clements@kcl.ac.uk>
Re: excel file <spamtrap@dot-app.org>
Re: Finding all open filehandles and closing them befor <vilmos@vilmos.org>
Re: generating time series graphs with perl (Anno Siegel)
Re: generating time series graphs with perl ctcgag@hotmail.com
Re: Howto: Search between 2 files <richard@zync.co.uk>
Re: Howto: Search between 2 files <tadmc@augustmail.com>
Re: myfile.cgi?image.gif saved as myfile.cgi in mozilla <Joe.Smith@inwap.com>
Re: OSs with Perl installed (Richard Williams)
Re: OSs with Perl installed <abigail@abigail.nl>
Re: Parsing Path Data into Tree Structure <dwall@fastmail.fm>
problem with pattern match <dave.verhoeven@pandora.be>
Re: problem with pattern match <mark.clements@kcl.ac.uk>
Re: problem with pattern match <dave.verhoeven@pandora.be>
Re: problem with pattern match <ittyspam@yahoo.com>
Re: problem with pattern match <mark.clements@kcl.ac.uk>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 30 Apr 2004 08:42:13 -0700
From: Bob <anon@no-domain.com>
Subject: 4 Perl books for sale at auction
Message-Id: <300420040842139277%anon@no-domain.com>
4 Perl books for sale at auction, bidding starts at just $1.00:
Perl Cookbook
<http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&category=3522%0D%0A&item=
%0D%0A4127154974>
Programming Perl
<http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&category=3522%0D%0A&item=
%0D%0A4127153941>
MySQL and Perl for the Web
<http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&category=3522%0D%0A&item=
%0D%0A4127155603>
Writing CGI Applications with Perl
<http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&category=3522%0D%0A&item=
%0D%0A4127152962>
------------------------------
Date: 30 Apr 2004 11:42:21 -0400
From: Uri Guttman <uri.guttman@fmr.com>
Subject: Re: another thing
Message-Id: <siscekq55v6q.fsf@configsvr.fmr.com>
>>>>> "R" == Robin <webmaster @ infusedlight . net> writes:
R> # my code is not meant as an example to newbies
R> # it is simply there
then mark it as such and don't post it. you post it you get critiques
and part of the reason for that is so newbies won't emulate your inane
coding style and lack of understanding basic logic.
uri
------------------------------
Date: Fri, 30 Apr 2004 12:21:42 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: cywin versus activestate on xp
Message-Id: <ek9490572b56mlcvt46kpolrojeeo0vb2v@4ax.com>
On Thu, 29 Apr 2004 22:10:27 -0000, "David K. Wall"
<dwall@fastmail.fm> wrote:
>perlwin32'. (One thing that makes perldoc MUCH better under win32 is
>to get a copy of the 'less' pager program and set the environment
>variable PERLDOC_PAGER to point to less.)
BTW: this is exactly what I hade done soon after installing AS perl
the very first time; I'm using less from UNXUTILS/UNXUPDATES, which is
fine. But I have some problems with some keybindings (yes, not a Perl
question!): e.g. I can't use PgUp, but I have to use 'b' instead. Not
so bad after all, but still slightly annoying...
I don't know if this is a inputrc issue or if it is possibly related
to any other cfg file: I've been thinking so many times to write to
the the collection maintainer for more info, but always been too lazy
to actually do that. So, *by any chance*, do you know how to fix that
behaviour offhand?!?
Michele
--
you'll see that it shouldn't be so. AND, the writting as usuall is
fantastic incompetent. To illustrate, i quote:
- Xah Lee trolling on clpmisc,
"perl bug File::Basename and Perl's nature"
------------------------------
Date: Fri, 30 Apr 2004 13:48:20 -0000
From: "David K. Wall" <dwall@fastmail.fm>
Subject: Re: cywin versus activestate on xp
Message-Id: <Xns94DB63BFD9994dkwwashere@216.168.3.30>
Michele Dondi <bik.mido@tiscalinet.it> wrote:
> On Thu, 29 Apr 2004 22:10:27 -0000, "David K. Wall"
><dwall@fastmail.fm> wrote:
>
>>perlwin32'. (One thing that makes perldoc MUCH better under win32
>>is to get a copy of the 'less' pager program and set the
>>environment variable PERLDOC_PAGER to point to less.)
>
> BTW: this is exactly what I hade done soon after installing AS
> perl the very first time; I'm using less from UNXUTILS/UNXUPDATES,
> which is fine. But I have some problems with some keybindings
> (yes, not a Perl question!): e.g. I can't use PgUp, but I have to
> use 'b' instead. Not so bad after all, but still slightly
> annoying...
>
> I don't know if this is a inputrc issue or if it is possibly
> related to any other cfg file: I've been thinking so many times to
> write to the the collection maintainer for more info, but always
> been too lazy to actually do that. So, *by any chance*, do you
> know how to fix that behaviour offhand?!?
Nope, PageDown and PageUp work just as you would expect for me. I
normally use space and 'b' anyway because that's how I learned it
originally, plus I don't have to move my hands as much that way.
In case it helps, here's the version of less I'm using:
less 381
Copyright (C) 2002 Mark Nudelman
less comes with NO WARRANTY, to the extent permitted by law.
For information about the terms of redistribution,
see the file named README in the less distribution.
Homepage: http://www.greenwoodsoftware.com/less
I have version 340 bundled with some GNU tools compiled for win32 and
it works as expected, too. Sorry.
--
David
------------------------------
Date: Fri, 30 Apr 2004 15:31:12 GMT
From: <digbygroks@verizon.net>
Subject: Re: cywin versus activestate on xp
Message-Id: <4jukc.120919$L31.23035@nwrddc01.gnilink.net>
In article <c6stfh$3dm$1@reader2.nmix.net>, Robin wrote:
> cygwin is hard and tedious to download, taking many days if your on a
> dial-up connection, there's nothing wrong with perl on win32. Just to tell
> you if your on dial-up.
> -Robin
Hey, thanks to all for the input; looks like I'm fine either way I go.
Thank god I'm not on dial up! First I got activestate, then while
surfing I read a comment something like, "use cygwin for writing perl
if you want to do it the easy way." I completely failed to grok
cygwin, didn't know getting cygwin would mean having a second perl
implementation on the box. So now I've got both but will probably use
cygwin as much as possible, at least for getting through
_learning_perl_, because the feel of all-command-line-all-the-time is
what I'm trying to approximate.
Thanks again!
--
beau
------------------------------
Date: Fri, 30 Apr 2004 14:16:15 GMT
From: "luc" <anonymous@disneyland.com>
Subject: excel file
Message-Id: <Pctkc.91610$oV3.5739580@phobos.telenet-ops.be>
Is it possible to write the contents of some variables to an excel file?
Let's say that I would like to write $age and $birth to cell C4 and C5 of
the second sheet of the student.xls file.
------------------------------
Date: Fri, 30 Apr 2004 15:21:00 +0100
From: Mark Clements <mark.clements@kcl.ac.uk>
Subject: Re: excel file
Message-Id: <409260c8$1@news.kcl.ac.uk>
luc wrote:
> Is it possible to write the contents of some variables to an excel file?
> Let's say that I would like to write $age and $birth to cell C4 and C5 of
> the second sheet of the student.xls file.
>
have you even looked on CPAN?
Mark
------------------------------
Date: Fri, 30 Apr 2004 10:21:29 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: excel file
Message-Id: <hoqdnbVT9913_Q_dRVn-uQ@adelphia.com>
luc wrote:
> Is it possible to write the contents of some variables to an excel file?
> Let's say that I would like to write $age and $birth to cell C4 and C5 of
> the second sheet of the student.xls file.
Try searching for "Excel" or "WriteExcel" at <http://search.cpan.org>. There
are far too many modules to list them all here.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: 30 Apr 2004 10:06:21 -0700
From: Vilmos Soti <vilmos@vilmos.org>
Subject: Re: Finding all open filehandles and closing them before exiting
Message-Id: <87k6zxv1iq.fsf@localhost.localdomain>
rook_5150@yahoo.com (Bryan Castillo) writes:
>> I have a signal handler which tries to unmount the disk in
>> the case of a sigint, but it will fail if copy from File::Copy
>> has an open filehandle on the mounted disk.
...
> Try this: (worked on my system Fedora Core 1)
...
> eval {
> copy ("/tmp/mountpoint/devzero", "/tmp/mountpoint/devnull");
> };
Thanks for the idea, but it didn't work for me. Our system
is RedHat 7.3 with perl 5.6.0. I know this is a bit old,
but for some reasons (which has nothing to do with technical
or internal bureaucratic issues) it is not so easy to upgrade.
Vilmos
------------------------------
Date: 30 Apr 2004 12:06:20 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: generating time series graphs with perl
Message-Id: <c6tffs$gh1$1@mamenchi.zrz.TU-Berlin.DE>
Martien Verbruggen <mgjv@tradingpost.com.au> wrote in comp.lang.perl.misc:
> On Thu, 29 Apr 2004 18:28:43 -0500,
> Po Boy <a5ufv8u02@sneakemail.com> wrote:
> >
> > On Thu, 29 Apr 2004 23:16:30 +0000, Martien Verbruggen wrote:
> >>
> >> That sort of graph isn't possible with GD::Graph. I don't know off
> >> hand of another package for Perl that does support that sort of thing.
> >
> > Yuk! well, thanks for your help. Maybe I'll see if I can get gnuplot or
> > octave or something to do it.
>
> Note that the chart you use can also be seen as a two-dimensional
> straight projection of a three-dimensional chart with the time on the
> Z axis (which points straight away from the view plane).
I'd describe that as a parametric plot of an arbitrary curve. The
Z values play the role of the curve parameter.
> If you get gnuplot to plot a three-dimensional chart, switch off
> display of the time axis and labels, and rotate it appropriately, you
> might just have what you're looking for.
>
> Any other package that does three-d charts and that lets you do a
> straight projection and switch off axes probably will do as well.
Any package that allows you to draw lines from one point to another
could basically do it. Assuming we have move_to( $x, $y) and
draw_to( $x, $y) (a la postscript), and the data is given in two
hashes %x and %y whose keys are the times (the same set of times in
both hashes), this draws the plot:
my @times = sort keys %x; # assuming a sortable time format
move_to( $x{ $_}, $y{ $_}) for shift @times;
draw_to( $x[ $_], $y[ $_]) for @times;
Anno
------------------------------
Date: 30 Apr 2004 15:30:32 GMT
From: ctcgag@hotmail.com
Subject: Re: generating time series graphs with perl
Message-Id: <20040430113032.675$mG@newsreader.com>
Po Boy <a5ufv8u02@sneakemail.com> wrote:
> On Fri, 30 Apr 2004 02:13:55 +0000, A. Sinan Unur wrote:
> >
> > OK, I have to admit I did not check that url before my initial
> > response. I just took time-series to mean time-series.
>
> I figured that may have been a problem. I still don't know a good,
> general name for these types of graphs. They're not really parametric,
> either, though they sometimes look like them.
Why aren't they parametric?
I make graphs kind of like that with GD. It's not too bad if you just want
function rather than form. If you want pretty axis with ticks and
perfectly places labels, it is very tedious.
If GD::Graph did scatter plots, it would be pretty easy to use get_hotspot
and then draw the lines yourself in GD, over the image created by
GD::Graph. In fact, if I had it to do over again, I might try this method
with my graphs. I'd just bin the x values of the scatterplot into evenly
spaced intervals, so it stops being a scatter plot.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Fri, 30 Apr 2004 11:30:44 +0100
From: "Richard Gration" <richard@zync.co.uk>
Subject: Re: Howto: Search between 2 files
Message-Id: <c6t9sd$peq$1@news.freedom2surf.net>
In article <158a491d.0404300103.643c25f4@posting.google.com>, "josetg"
<josetg@yahoo.com> wrote:
> Hi,
> Am a absolute newbie.
> I have a list of keywords in one file, and the text to search for in 2nd
> file. I need to find lines in the 2nd file which match keywords in the
> 1st file. The output should be sorted by line # in 2nd file. Many
> thanks
> Jose
Not a perl solution but ... are you on unix? If so
grep -f keyword_file search_file
should do what you want. Put your keywords one per line in the
keyword file. If you want complete word matches only (eg "one" in
the keyword file matches "one" in the search file but *not* "done") then
surround the keywords with \< and \> (ie for case above put "\<one\>" in
the keyword file).
HTH
Rich
------------------------------
Date: Fri, 30 Apr 2004 07:11:06 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Howto: Search between 2 files
Message-Id: <slrnc94giq.54v.tadmc@magna.augustmail.com>
josetg <josetg@yahoo.com> wrote:
> Am a absolute newbie.
Then you have quite a bit of reading to do...
(have you scanned the Perl Frequently Asked Questions to see if they
help with parts of what you want to do?
)
> I have a list of keywords in one file, and the text to search for in 2nd file.
You open files with:
perldoc -f open
You read and write files with "I/O Operators":
perldoc perlop
You can store strings in an array or hash:
perldoc perldata
> I need to find lines in the 2nd file which match keywords in the 1st file.
Pattern matching can be used to do that:
perldoc -q match
perldoc perlrequick.pod
perldoc perlretut.pod
perldoc perlre
> The output should be sorted by line # in 2nd file.
You do sorting with the sort() function:
perldoc -f sort
There is a special variable that contains the line number from
an input file (named $.):
perldoc perlvar
Code up as much as you can, and we will help you with the rest.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 30 Apr 2004 15:24:58 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: myfile.cgi?image.gif saved as myfile.cgi in mozilla?
Message-Id: <edukc.3614$kh4.231066@attbi_s52>
Peter Payne wrote:
> my $s_buffer = undef;
> while ( read( EXECGZIP, $s_buffer, 1024 ) )
> {
> print( $s_buffer );
> }
You need to put
binmode STDOUT;
in front of that loop.
-Joe
------------------------------
Date: Fri, 30 Apr 2004 17:33:02 +0000 (UTC)
From: rdwillia@hgmp.mrc.ac.uk (Richard Williams)
Subject: Re: OSs with Perl installed
Message-Id: <c6u2ke$9cs$1@helium.hgmp.mrc.ac.uk>
In article <c6pu7j$3q4$1@canopus.cc.umanitoba.ca>,
Walter Roberson <roberson@ibd.nrc-cnrc.gc.ca> wrote:
>In article <6f_jc.6910$k%.233786@news20.bellglobal.com>,
>Matt Garrish <matthew.garrish@sympatico.ca> wrote:
>:Then again you never know, they may be secretly working on MSPerl or Perl#.
>
>It would come with a license that said that you could only make
>socket connections to machines that had Microsoft licenses;
>and you'd need a Passport account to use MSCPAN . Certain modules
>would be "integrated with the operating system" and declared
>non-overridable -- @INC would be ignored for them, or one
>of the Windows directories would *always* be searched first.
Curiously enough, MS does distribute Perl and several GNU development
tools (at no cost) as part of their Cygwin-style 'Windows Services for
Unix' (shouldn't that be the other way round?):
http://www.microsoft.com/windows/sfu/productinfo/features/default.asp
All part of a 'robust scripting environment', apparently (it probably
wouldn't be diplomatic to ask them what scripting langages might be rather
less robust). For the unitiated, 'Windows Services for Unix' is MS's
purely altruistic attempt to provide a temporary crutch for benighted
Unix users who must soon be weaned away from their crack-like dependence
on desperately outdated administration tools, brought into the Light
of a Modern Enterprise-class operating system, and introduced to the Joys
of editing the Registry and applying this week's Critical Outlook Patch.
Or something.
Richard.
------------------------------
Date: 30 Apr 2004 17:56:55 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: OSs with Perl installed
Message-Id: <slrnc954r7.egl.abigail@alexandra.abigail.nl>
Jim Cochrane (jtc@shell.dimensional.com) wrote on MMMDCCCXCIII September
MCMXCIII in <URL:news:slrnc90c86.jn1.jtc@shell.dimensional.com>:
:}
:} Unfortunately, since MS does not include Perl as a standard component,
:} it's also true that most computers these days do not have Perl installed.
:} (I can only think of advantages to MS including Perl with their OS -
:} can't think of any disadvantages, so I'm can't understand why they don't
:} do it. Am I missing something?)
I think that's bloody obvious. If you sell something, you are supposed
to support it as well. Perl development is something that isn't under
Microsoft's control. Considering the platforms Microsoft is mostly
targeting (the desktop, servers with prepacked solutions), I can't
understand why anyone doesn't understand Microsoft doesn't include Perl
in its OS.
Abigail
--
perl -we 'eval {die ["Just another Perl Hacker\n"]}; print ${$@}[$#{@${@}}]'
------------------------------
Date: Fri, 30 Apr 2004 17:31:28 -0000
From: "David K. Wall" <dwall@fastmail.fm>
Subject: Re: Parsing Path Data into Tree Structure
Message-Id: <Xns94DB899421047dkwwashere@216.168.3.30>
Dale <desau@aisc.ac.cy> wrote:
> What I am trying
> to do is take a very plain text string describing a path and parse
> that into a tree to display in html.
>
> My incoming data via DBI looks like this
>
> /folder 1/image1.jpg
> /folder 1/subfolder 1/image2.jpg
> /folder 1/subfolder 1/subsub folder 1/image3.jpg
> /folder 1/image4.jpg
> /folder 2/image5.jpg
> /folder 1/subfolder 2/image6.jpg
> etc...
>
> and I want to output sort of like
>
> folder 1
> -> subfolder 1
> -> -> subsubfolder 1
> -> -> -> image3.jpg
> -> -> image2.jpg
> -> subfolder 2
> -> -> image6.jpg
> -> image1.jpg
> -> image4.jpg
> folder 2
> -> image5.jpg
Search Google groups for Message-ID
<slrnbhtb7u.4o7.tadmc@magna.augustmail.com> and you'll find an
algorithm you can adapt.
------------------------------
Date: Fri, 30 Apr 2004 16:02:47 GMT
From: "Dafke8" <dave.verhoeven@pandora.be>
Subject: problem with pattern match
Message-Id: <HMukc.1058$up2.167560332@hebe.telenet-ops.be>
Hi all,
I'm making a perl script that takes names of people out of a text and than I
must link the persons name to the text where his name was in.
But now i'm trying to get a list with all the names in the text. I already
have an array with the text but when i try to get all the names in a list, i
only get the first name.
Below is the code i use for it:
(every name is between a <span class="naam" id="n1"></span> tag)
foreach $i (@inputtext){
$i =~ /<span\sclass="naam"\sid="n[0-9]+">(.*?)<\/span>/g;
@test = $1;
}
Does anyone know what the problem is with my expression?
below is a piece of the text i'm searchin in:
<h3><font color="#0000FF">BA585 Akte nr.<span class="akte"
id="a0">1774-1</span> Bestand: 480 - 481</font></h3>
<p>Op 21 februari 1774 lenen <span class="naam" id="n0">Verachtert Petrus
Josephus</span> en zijn echtgenote <span class="naam" id="n1">Verboven Anna
Elisabeth</span> bij <span class="naam" id="n2">Bleirinckx Marten</span>,
<span class="naam" id="n3">Groenen Jan</span> en <span class="naam"
id="n4">Van Nuten Jan</span>, administrateurs van de fondatie gefondeerd
door wijlen de Heer <span class="naam" id="n5">Swinnen Henricus</span>, ten
gunste van de <span class="plaats" id="p1">kapel van Meren</span>.</p>
<p>Zij hypothekeren een huis, hof,schuur en binnenveld in <span
class="plaats" id="p2">Boeckel</span>. Palende oost: den <span
class="plaats" id="p3">Aert</span>, zuid: d'erfgen. <span class="naam"
id="n6">Bellens Adr.</span>, west: <span class="naam" id="n7">Van Eynde
Jan</span>, noord: <span class="naam" id="n8">Hermans Peeter</span> en een
perceel land genaamd den <span class="plaats" id="p4">langen reep</span>.
Palende oost: d'erfgen. <span class="naam" id="n9">Bellens Adr.</span> en
den <span class="plaats" id="p5">Aert</span>, zuid: de <span class="plaats"
id="p6">Bijlestraete</span> west: <span class="naam" id="n10">Verdonck
Maria</span>, noord: <span class="naam" id="n11">Van Hove Jan</span>.</p>
------------------------------
Date: Fri, 30 Apr 2004 17:16:44 +0100
From: Mark Clements <mark.clements@kcl.ac.uk>
Subject: Re: problem with pattern match
Message-Id: <40927be7$1@news.kcl.ac.uk>
Dafke8 wrote:
> must link the persons name to the text where his name was in.
> But now i'm trying to get a list with all the names in the text. I already
> have an array with the text but when i try to get all the names in a list, i
> only get the first name.
>
> foreach $i (@inputtext){
> $i =~ /<span\sclass="naam"\sid="n[0-9]+">(.*?)<\/span>/g;
> @test = $1;
> }
take a look at man perlop - /g on a match operator means the expression returns a list of
matches in parentheses. You want something like:
my @matches = ();
foreach my $line( @inputtext){
push @matches,$line =~ m!<span\s+class="naam"\s+id="n[0-9]+">(.*?)</span>!g;
}
Mark
------------------------------
Date: Fri, 30 Apr 2004 16:49:01 GMT
From: "Dafke8" <dave.verhoeven@pandora.be>
Subject: Re: problem with pattern match
Message-Id: <1svkc.1246$vs6.184487035@hebe.telenet-ops.be>
> take a look at man perlop - /g on a match operator means the expression
returns a list of
> matches in parentheses. You want something like:
>
> my @matches = ();
> foreach my $line( @inputtext){
> push @matches,$line =~
m!<span\s+class="naam"\s+id="n[0-9]+">(.*?)</span>!g;
> }
>
> Mark
>
Thank you, now it works. But I have one question, why do you use ! for the
reg. expr. and not /, i've tried it with / and it did not work.
------------------------------
Date: Fri, 30 Apr 2004 12:20:57 -0400
From: Paul Lalli <ittyspam@yahoo.com>
Subject: Re: problem with pattern match
Message-Id: <20040430121807.Y1160@dishwasher.cs.rpi.edu>
On Fri, 30 Apr 2004, Dafke8 wrote:
> Hi all,
>
> I'm making a perl script that takes names of people out of a text and than I
> must link the persons name to the text where his name was in.
> But now i'm trying to get a list with all the names in the text. I already
> have an array with the text but when i try to get all the names in a list, i
> only get the first name.
> Below is the code i use for it:
> (every name is between a <span class="naam" id="n1"></span> tag)
>
> foreach $i (@inputtext){
> $i =~ /<span\sclass="naam"\sid="n[0-9]+">(.*?)<\/span>/g;
> @test = $1;
> }
>
> Does anyone know what the problem is with my expression?
There are, unfortunately, several problems:
1) You're reassigning the value of @test each time through the loop,
rather than pushing new values onto it.
2) You're reassigning the value of @test *every* time through the loop,
regardless of whether the pattern match succeeded.
3) You're using a global pattern match but only (theoretically) storing
one of the possible matches, rather than all of them.
4) You're only looking for the whole pattern on each line, ignoring the
possibility that the pattern could span multiple lines of your input.
5) And finally, you're using regular expressions to parse HTML, rather
than one of the several HTML Parsing modules available on CPAN.
Paul Lalli
>
>
> below is a piece of the text i'm searchin in:
>
> <h3><font color="#0000FF">BA585 Akte nr.<span class="akte"
> id="a0">1774-1</span> Bestand: 480 - 481</font></h3>
> <p>Op 21 februari 1774 lenen <span class="naam" id="n0">Verachtert Petrus
> Josephus</span> en zijn echtgenote <span class="naam" id="n1">Verboven Anna
> Elisabeth</span> bij <span class="naam" id="n2">Bleirinckx Marten</span>,
> <span class="naam" id="n3">Groenen Jan</span> en <span class="naam"
> id="n4">Van Nuten Jan</span>, administrateurs van de fondatie gefondeerd
> door wijlen de Heer <span class="naam" id="n5">Swinnen Henricus</span>, ten
> gunste van de <span class="plaats" id="p1">kapel van Meren</span>.</p>
> <p>Zij hypothekeren een huis, hof,schuur en binnenveld in <span
> class="plaats" id="p2">Boeckel</span>. Palende oost: den <span
> class="plaats" id="p3">Aert</span>, zuid: d'erfgen. <span class="naam"
> id="n6">Bellens Adr.</span>, west: <span class="naam" id="n7">Van Eynde
> Jan</span>, noord: <span class="naam" id="n8">Hermans Peeter</span> en een
> perceel land genaamd den <span class="plaats" id="p4">langen reep</span>.
> Palende oost: d'erfgen. <span class="naam" id="n9">Bellens Adr.</span> en
> den <span class="plaats" id="p5">Aert</span>, zuid: de <span class="plaats"
> id="p6">Bijlestraete</span> west: <span class="naam" id="n10">Verdonck
> Maria</span>, noord: <span class="naam" id="n11">Van Hove Jan</span>.</p>
>
>
>
>
------------------------------
Date: Fri, 30 Apr 2004 18:41:05 +0100
From: Mark Clements <mark.clements@kcl.ac.uk>
Subject: Re: problem with pattern match
Message-Id: <40928fb2$1@news.kcl.ac.uk>
Dafke8 wrote:
> Thank you, now it works. But I have one question, why do you use ! for the
> reg. expr. and not /, i've tried it with / and it did not work.
because it means you can avoid escaping the / in </span>. There are a
number of characters that you can use to delimit a regular expression.
See Paul's post: he makes a number of very good points.
Mark
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 V10 Issue 6492
***************************************