[26831] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 8860 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 17 14:05:34 2006

Date: Tue, 17 Jan 2006 11:05:06 -0800 (PST)
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, 17 Jan 2006     Volume: 10 Number: 8860

Today's topics:
    Re: Creating and outputting a generic data structure? (Anno Siegel)
    Re: Creating and outputting a generic data structure? <ithinkiam@gmail.com>
    Re: ExpatXS: 'Can't call method "read" on an undefined  xhoster@gmail.com
    Re: ExpatXS: 'Can't call method "read" on an undefined  xhoster@gmail.com
    Re: ExpatXS: 'Can't call method "read" on an undefined  (Anno Siegel)
        Math::Knuth::DLX <rvtol+news@isolution.nl>
    Re: Math::Knuth::DLX <rvtol+news@isolution.nl>
    Re: Script execution blocked when reading from a socket <nospam@thanksanyway.org>
    Re: Script execution blocked when reading from a socket (Anno Siegel)
    Re: Script execution blocked when reading from a socket <nospam@thanksanyway.org>
    Re: Script execution blocked when reading from a socket (Anno Siegel)
    Re: Script execution blocked when reading from a socket xhoster@gmail.com
    Re: Script execution blocked when reading from a socket (Anno Siegel)
    Re: Script execution blocked when reading from a socket <nospam@thanksanyway.org>
    Re: Script execution blocked when reading from a socket <nospam@thanksanyway.org>
        Search Question <kigar@gmx.net>
    Re: Search Question <rvtol+news@isolution.nl>
    Re: Search Question <noreply@gunnar.cc>
    Re: Search Question <kigar@gmx.net>
    Re: Search Question <noreply@gunnar.cc>
    Re: Search Question <matthew.garrish@sympatico.ca>
    Re: Search Question <rvtol+news@isolution.nl>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 17 Jan 2006 14:18:44 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Creating and outputting a generic data structure?
Message-Id: <dqiuc4$l3h$8@mamenchi.zrz.TU-Berlin.DE>

Chris  <ithinkiam@gmail.com> wrote in comp.lang.perl.misc:
> Anno Siegel wrote:
> > Chris  <ithinkiam@gmail.com> wrote in comp.lang.perl.misc:

[...]

> ... . One question though, is there any reason why 
> you used this:
> 
> substr( $expanded[ -1], $-[ 0], $+[ 0] - $-[ 0]) = $char;
> 
> instead of:
> 
> substr( $expanded[ -1], $-[ 0], $+[ 0] - $-[ 0], $char);
> ?

I find the assignment form more readable than the four-argument form
when replacing a substring.  I restrict the four-argument form to
its specialty: returning the unchanged substring as well as replacing
it in the string.  That isn't needed all that often, but can come in
handy.

Anno
-- 
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article.  Click on 
"show options" at the top of the article, then click on the 
"Reply" at the bottom of the article headers.


------------------------------

Date: Tue, 17 Jan 2006 16:43:03 +0000
From: Chris <ithinkiam@gmail.com>
Subject: Re: Creating and outputting a generic data structure?
Message-Id: <dqj6qn$1sde$1@godfrey.mcc.ac.uk>

Anno Siegel wrote:
> Chris  <ithinkiam@gmail.com> wrote in comp.lang.perl.misc:
>> Anno Siegel wrote:
>>> Chris  <ithinkiam@gmail.com> wrote in comp.lang.perl.misc:
> 
> [...]
> 
>> ... . One question though, is there any reason why 
>> you used this:
>>
>> substr( $expanded[ -1], $-[ 0], $+[ 0] - $-[ 0]) = $char;
>>
>> instead of:
>>
>> substr( $expanded[ -1], $-[ 0], $+[ 0] - $-[ 0], $char);
>> ?
> 
> I find the assignment form more readable than the four-argument form
> when replacing a substring.  I restrict the four-argument form to
> its specialty: returning the unchanged substring as well as replacing
> it in the string.  That isn't needed all that often, but can come in
> handy.
> 
OK. Thanks again...


------------------------------

Date: 17 Jan 2006 16:22:23 GMT
From: xhoster@gmail.com
Subject: Re: ExpatXS: 'Can't call method "read" on an undefined value' after ca. 500 XML files
Message-Id: <20060117112223.031$wh@newsreader.com>

Arvin Portlock <nomail@sorry.com> wrote:
>  >>>In using ExpatXS to parse large batches of XML files
>  >>>something curious happens. After parsing something close
>  >>>to 500 files the program crashes with the error:
>  >>>
>  >>>Can't call method "read" on an undefined value at
>  >>>/xxx/perl5.8/lib/site_perl/5.8.7/sun4-solaris-thread-multi/
>  >>>XML/SAX/ExpatXS.pm line 155.
>
>  >xhoster@gmail.com wrote:
>  >I've now tried your program with this exact version of ExpatXS.pm, and
>  >it also works for at least 10_000 files.
>
> So I made one change to ExpatXS.pm which worked. I explicitly
> closed $fh here:
>
> sub _parse_systemid {
>      my $self = shift;
>      my $fh = IO::File->new(shift);
>      $self->{ParseOptions}->{ParseFunc} = \&ParseStream;
>      $self->{ParseOptions}->{ParseFuncParam} = $fh;
>      $self->_parse;
>      $fh->close;
> }

I think you would be better off changing the 3rd line to:

my $fh = IO::File->new(shift) or die ("file open failed with !=$! and
\@=$@");

And seeing exactly what the problem is.  That might lead you to a better
way to fix it.  (or it might not...)  (maybe croak rather than die)


>
> I'm a little nervous this solution may be simplistic since
> individual XML documents can span multiple files, though
> none in this particular batch do. I should test that on
> some other files I have. A Google search for:
>
> IO::File perl bug file close solaris
>
> Brings up some interesting things. Problems closing files
> are noticeable on Solaris because its descriptor limit
> is typically quite low. Quoting:
>
>    You can reproduce the problem on other systems, too.
>    Just set the file descriptor limit to a low value (e.g.
>    by using limits -n). Other systems like Linux and
>    FreeBSD have much higher default limits than Solaris.
>
> But I don't know, 10,000 files seems like a pretty large
> limit for any system.

Yes, and I've even let it go much higher than 10,000 (although at that
point it was processing the same 10,000 files over and over, but I don't
think that should matter, each independent opening of the file gets a new
descriptor).

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


------------------------------

Date: 17 Jan 2006 16:38:27 GMT
From: xhoster@gmail.com
Subject: Re: ExpatXS: 'Can't call method "read" on an undefined value' after ca. 500 XML files
Message-Id: <20060117113827.302$bD@newsreader.com>

Arvin Portlock <nomail@sorry.com> wrote:
> xhoster@gmail.com wrote:
>
> > Arvin Portlock  wrote:
> >
> > ># $Id: ExpatXS.pm,v 1.39 2005/11/10 09:38:31 cvspetr Exp $
> >
> > I've now tried your program with this exact version of ExpatXS.pm, and
> > it also works for at least 10_000 files.
>
> And I just tried it on Windows and it works fine, though not
> quite the same version of perl and an old version of ExpatXS.
> I'm not a system administrator so I had to compile and install
> my own local copy of perl and miscellaneous modules, something
> I do infrequently. Perhaps I did something wrong there. At
> least it isn't a bug in my program, and it seems not to be a
> bug in ExpatXS. It seems doubtful it would be a solaris-specific
> bug of any kind.

Actually I wouldn't be at all surprised if it is a bug in ExpatXS (or a
module it is derived from) which only presents itself on Solaris, or a bug
in the Solaris port of Perl which presents itself when used with ExpatXS.
Try to hack your modules so that you can get the actual error message.


> So I could try creating a single-file version of the program
> and call it through a loop in a shell script. It's a bit less
> convenient to maintain state. I wonder what kind of hit I'll
> take doing that? Or I could use pure perl. Except the reason I'm
> doing this is the Java DOM solution in place is way too slow
> so I was hoping for a more impressive boost in speed.

Since it so easy to do, I would at least try pure perl and prove/quantify
its slowness before trying the single-file hack.



> Maybe I'll try and hack a destructor for
> the parse object.

If you have any luck on that, please let us know.  I'm not sure how a lack
of a needed destructor would show up as OS-specific bug, though.

Thanks,

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


------------------------------

Date: 17 Jan 2006 16:48:30 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: ExpatXS: 'Can't call method "read" on an undefined value' after ca. 500 XML files
Message-Id: <dqj74u$27h$2@mamenchi.zrz.TU-Berlin.DE>

 <xhoster@gmail.com> wrote in comp.lang.perl.misc:
> Arvin Portlock <nomail@sorry.com> wrote:
> > xhoster@gmail.com wrote:
> > > Arvin Portlock  wrote:

[...]

> > Maybe I'll try and hack a destructor for
> > the parse object.
> 
> If you have any luck on that, please let us know.  I'm not sure how a lack
> of a needed destructor would show up as OS-specific bug, though.

Accumulation of open file handles would be tolerated to varying degrees
by different OSes.  A destructor just might avoid the accumulation.  Then
again, it may not be called at all, for the same reason the accumulation
happens.

Anno
-- 
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article.  Click on 
"show options" at the top of the article, then click on the 
"Reply" at the bottom of the article headers.


------------------------------

Date: Tue, 17 Jan 2006 15:58:08 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Math::Knuth::DLX
Message-Id: <dqj48b.12o.1@news.isolution.nl>

No, sorry, no actual Dancing Links module yet.

I just s///g-ed a Sudoku solver in ugly C that I found 
at the bottom of http://magictour.free.fr/suexco.txt 
into a just as ugly Perl version:

  http://www.xs4all.nl/~rvtol/DLX/

-- 
Affijn, Ruud

"Gewoon is een tijger."


------------------------------

Date: Tue, 17 Jan 2006 17:34:21 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Math::Knuth::DLX
Message-Id: <dqj9tc.tc.1@news.isolution.nl>

Dr.Ruud schreef:

>   http://www.xs4all.nl/~rvtol/DLX/

More here:
http://www.setbb.com/phpbb/viewtopic.php?t=206&start=30&mforum=sudoku 

-- 
Affijn, Ruud

"Gewoon is een tijger."


------------------------------

Date: Tue, 17 Jan 2006 07:54:37 -0800
From: "Mark" <nospam@thanksanyway.org>
Subject: Re: Script execution blocked when reading from a socket
Message-Id: <9qCdnVwt8MCpjlDeRVn-tw@w-link.net>

"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote:
>>
>>    # Select() is supposed to succeed if the socket has data,
>>    # or else timeout and return FALSE.
>>    if (!(select (SOCK, undef, undef, 10.0))) {goto NEXT_IP;}
>
> Select guarantees that at least on character is available.  You
> are trying to read an entire line.  Try reading a single character.

Is this what you are suggesting?

if (!recv(SOCK, $line, 1, 0)) {goto NEXT_IP;}

I tried this, but my script still hangs up on the same IP
addresses that caused problems before.

-Mark




------------------------------

Date: 17 Jan 2006 16:38:45 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Script execution blocked when reading from a socket
Message-Id: <dqj6il$27h$1@mamenchi.zrz.TU-Berlin.DE>

Mark <nospam@thanksanyway.org> wrote in comp.lang.perl.misc:
> "Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote:
> >>
> >>    # Select() is supposed to succeed if the socket has data,
> >>    # or else timeout and return FALSE.
> >>    if (!(select (SOCK, undef, undef, 10.0))) {goto NEXT_IP;}
> >
> > Select guarantees that at least on character is available.  You
> > are trying to read an entire line.  Try reading a single character.
> 
> Is this what you are suggesting?
> 
> if (!recv(SOCK, $line, 1, 0)) {goto NEXT_IP;}

It is, or rather, it was before I noticed you are not using select() right.
In particular, the first argument isn't a filehandle but a bit vector of
file numbers.  See perldoc -f select.  The standard module IO::Select takes
care of the technicalities.

> I tried this, but my script still hangs up on the same IP
> addresses that caused problems before.

Well, so far you have been relying on random results from select().
Try the real thing.

Anno
-- 
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article.  Click on 
"show options" at the top of the article, then click on the 
"Reply" at the bottom of the article headers.


------------------------------

Date: Tue, 17 Jan 2006 09:09:42 -0800
From: "Mark" <nospam@thanksanyway.org>
Subject: Re: Script execution blocked when reading from a socket
Message-Id: <PfednTkKq6BRuVDenZ2dnUVZ_s2dnZ2d@w-link.net>

"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote:
>
> It is, or rather, it was before I noticed you are not using select() 
> right.

On second thought, select() isn't going to work under Windows, is it?




------------------------------

Date: 17 Jan 2006 17:19:42 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Script execution blocked when reading from a socket
Message-Id: <dqj8ve$4gl$1@mamenchi.zrz.TU-Berlin.DE>

Mark <nospam@thanksanyway.org> wrote in comp.lang.perl.misc:
> "Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote:
> >
> > It is, or rather, it was before I noticed you are not using select() 
> > right.
> 
> On second thought, select() isn't going to work under Windows, is it?

I don't know.  The documentation says nothing about the possibility of
select() being unimplemented.  It usually does.

There are, however, two warnings that may be pertinent, one about
select() with sockets and one about select() with buffered IO.

Anno
-- 
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article.  Click on 
"show options" at the top of the article, then click on the 
"Reply" at the bottom of the article headers.


------------------------------

Date: 17 Jan 2006 17:24:41 GMT
From: xhoster@gmail.com
Subject: Re: Script execution blocked when reading from a socket
Message-Id: <20060117122441.571$1H@newsreader.com>

"Mark" <nospam@thanksanyway.org> wrote:
>
>    # Setting autoflush is supposed to help prevent blocking
>    # when attempting to read from the socket. . .

Setting autoflush is only relevent for handles you write to.  It has
no effect on reading.

>    my $oldh = select(SOCK);$|=1;select($oldh);$|=1;

     SOCK->autoflush(1); # more readable

Also, you should use lexical file handles.


>
>    # Select() is supposed to succeed if the socket has data,
>    # or else timeout and return FALSE.
>    if (!(select (SOCK, undef, undef, 10.0))) {goto NEXT_IP;}

Hmm...  perldoc -f select.  Nope, it doesn't do what you seem to think
it does.

>
>    # Script will eventually hang on the following line
>    if (!defined($line = <SOCK>)) {goto NEXT_IP;}

select, if used properly, tells you you have something to read.  It doesn't
say that that thing waiting to be read is an entire line.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


------------------------------

Date: 17 Jan 2006 17:43:54 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Script execution blocked when reading from a socket
Message-Id: <dqjacq$5jj$1@mamenchi.zrz.TU-Berlin.DE>

 <xhoster@gmail.com> wrote in comp.lang.perl.misc:
> "Mark" <nospam@thanksanyway.org> wrote:
> >
> >    # Setting autoflush is supposed to help prevent blocking
> >    # when attempting to read from the socket. . .
> 
> Setting autoflush is only relevent for handles you write to.  It has
> no effect on reading.
> 
> >    my $oldh = select(SOCK);$|=1;select($oldh);$|=1;
> 
>      SOCK->autoflush(1); # more readable
> 
> Also, you should use lexical file handles.

Yikes, that works with a plain old package filehandle? I hadn't noticed.

Anno

[snip]
-- 
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article.  Click on 
"show options" at the top of the article, then click on the 
"Reply" at the bottom of the article headers.


------------------------------

Date: Tue, 17 Jan 2006 09:50:44 -0800
From: "Mark" <nospam@thanksanyway.org>
Subject: Re: Script execution blocked when reading from a socket
Message-Id: <joudnY91vYj2s1DenZ2dnUVZ_vydnZ2d@w-link.net>

<xhoster@gmail.com> wrote:
>
> Hmm...  perldoc -f select.  Nope, it doesn't do what you seem to think
> it does.

Ok, you guys put me on the right track and I finally got it working.
I had access to working sample code, but I just didn't understand
what it was doing (I'm still fuzzy on how the vector works, but I
now know enough to be dangerous.)

Thanks!
-Mark




------------------------------

Date: Tue, 17 Jan 2006 09:52:09 -0800
From: "Mark" <nospam@thanksanyway.org>
Subject: Re: Script execution blocked when reading from a socket
Message-Id: <YfGdnSMh-7Yis1DenZ2dnUVZ_sSdnZ2d@w-link.net>

"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote:
> <xhoster@gmail.com> wrote in comp.lang.perl.misc:
>>
>> Also, you should use lexical file handles.
>
> Yikes, that works with a plain old package filehandle? I hadn't noticed.

Someday, when I'm a grownup, I'll understand what you're discussing here.

-Mark




------------------------------

Date: Tue, 17 Jan 2006 15:38:26 +0100
From: "Reinhard Glauber" <kigar@gmx.net>
Subject: Search Question
Message-Id: <43cd0158$0$20772$9b4e6d93@newsread4.arcor-online.net>

DQpPaywgdGhlIHdnZXQgcHJvYmxlbSBpcyBzb2x2ZWQsIGJ1dCBub3cgSSBoYXZlIGEgc2VhcmNo
IFByb2JsZW0NCg0KSSBoYXZlICR0ZXh0ICB3aGljaCBjb250YWlucyBUZXh0IDopDQpJZiBoZSBm
aW5kcyAiRS1NYWlsIiwgdGhlbiBoZSBjdXRzIHRoZSB3aG9sZSBsaW5lIGFuZCBwcmludHMgaXQu
DQoNCiBpZiAoJGh0bWwgPX4gL0UtTWFpbC4qXG4vKQ0Kew0KcHJpbnQgIiQmXG4iOw0KfQ0KDQoN
CldoYXQgSSB3YW50IHRvIGRvIG5vdyBpcywgdGhhdCBQZXJsIGdyYWJzIDUgbGluZXMgQkVGT1JF
IHRoZSBvY2N1cmFuY2Ugb2YgRS1NYWlsLg0KDQpQZXJsIEdtYmgNCk11bmljaHN0cmVldCA1DQo4
MDgwMiBNdW5pY2gNClRlbC46IDkwMzg0MjkwMzgvMzg0MjAzODQNCkUtTWFpbDogYmx1YmJAYmx1
YmIuZGUNCg0KU28gUGVybCBzaG91bGQgY3V0IGFsbCB0aGUgNCBMaW5lcyBiZWZvciBFLU1haWwg
YW5kIHB1dCBpdCBpbnRvIGFuIGFycmF5LCBvciBzb21ldGhpbmcgbGlrZSB0aGF0Lg0KDQpJIGRv
bnQgbmVlZCB0aGUgd2hvbGUgY29kZSwganVzdCBzb21lIHRpcHMgaG93IHRvIGRvIHRoYXQNCg0K
VEhBTktTDQoNCg0K



------------------------------

Date: Tue, 17 Jan 2006 16:10:17 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Search Question
Message-Id: <dqj4vl.18c.1@news.isolution.nl>

Reinhard Glauber schreef:

>  if ($html =~ /E-Mail.*\n/)
>  {
>      print "$&\n";
>  }
> 
> What I want to do now is, that Perl grabs 5 lines BEFORE the
> occurance of E-Mail. 

Or 4 lines before:

  print $1 if $html =~ /(.*\n)(?:.*\n){3}E-Mail.*/;

-- 
Affijn, Ruud

"Gewoon is een tijger."


------------------------------

Date: Tue, 17 Jan 2006 16:29:36 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Search Question
Message-Id: <434gn4F1lv9mpU1@individual.net>

Reinhard Glauber wrote:
> Ok, the wget problem is solved, but now I have a search Problem
> 
> I have $text  which contains Text :)
> If he finds "E-Mail", then he cuts the whole line and prints it.
> 
>  if ($html =~ /E-Mail.*\n/)
> {
> print "$&\n";
> }

Then you solved your search problem, right?

> What I want to do now is, that Perl grabs 5 lines BEFORE the occurance of E-Mail.

Then you need to tell Perl to do that.

- Which efforts did you make to complete the task before asking for help 
here?
- Where is the code showing your best shot?
- Have you read the posting guidelines for this group, as Sinan 
suggested in the other thread?

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


------------------------------

Date: Tue, 17 Jan 2006 16:33:08 +0100
From: "Reinhard Glauber" <kigar@gmx.net>
Subject: Re: Search Question
Message-Id: <43cd0e28$0$20778$9b4e6d93@newsread4.arcor-online.net>

DQoiRHIuUnV1ZCIgPHJ2dG9sK25ld3NAaXNvbHV0aW9uLm5sPiBzY2hyaWViIGltIE5ld3NiZWl0
cmFnIG5ld3M6ZHFqNHZsLjE4Yy4xQG5ld3MuaXNvbHV0aW9uLm5sLi4uDQo+IFJlaW5oYXJkIEds
YXViZXIgc2NocmVlZjoNCg0KPiA+IFdoYXQgSSB3YW50IHRvIGRvIG5vdyBpcywgdGhhdCBQZXJs
IGdyYWJzIDUgbGluZXMgQkVGT1JFIHRoZQ0KPiA+IG9jY3VyYW5jZSBvZiBFLU1haWwuIA0KPiAN
Cj4gT3IgNCBsaW5lcyBiZWZvcmU6DQo+IA0KPiAgIHByaW50ICQxIGlmICRodG1sID1+IC8oLipc
bikoPzouKlxuKXszfUUtTWFpbC4qLzsNCg0KDQp0aGF0IHdvcmtzIDopIHRoYW5rIHlvdQ0KDQpi
dXQgd2hhdCBtZWFucyAoPzouKlxuKQ0K



------------------------------

Date: Tue, 17 Jan 2006 16:57:57 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Search Question
Message-Id: <434ic9F1lghppU1@individual.net>

Reinhard Glauber wrote:
> "Dr.Ruud" schrieb:
>>Reinhard Glauber schreef:
>>>What I want to do now is, that Perl grabs 5 lines BEFORE the
>>>occurance of E-Mail. 
>>
>>Or 4 lines before:
>>
>>  print $1 if $html =~ /(.*\n)(?:.*\n){3}E-Mail.*/;
> 
> that works :) thank you
> 
> but what means (?:.*\n)

Yes, how rude of you, Dr. Ruud, to not thoroughly explain every detail 
of the expression you posted!!

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


------------------------------

Date: Tue, 17 Jan 2006 11:04:30 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Search Question
Message-Id: <eA8zf.13065$xk1.245225@news20.bellglobal.com>


"Reinhard Glauber" <kigar@gmx.net> wrote in message 
news:43cd0e28$0$20778$9b4e6d93@newsread4.arcor-online.net...
>
> "Dr.Ruud" <rvtol+news@isolution.nl> schrieb im Newsbeitrag 
> news:dqj4vl.18c.1@news.isolution.nl...
>> Reinhard Glauber schreef:
>
>> > What I want to do now is, that Perl grabs 5 lines BEFORE the
>> > occurance of E-Mail.
>>
>> Or 4 lines before:
>>
>>   print $1 if $html =~ /(.*\n)(?:.*\n){3}E-Mail.*/;
>
>
> that works :) thank you
>
> but what means (?:.*\n)
>

You should be quite capable of looking it up in perlre under the extended 
patterns section.

Matt 




------------------------------

Date: Tue, 17 Jan 2006 17:32:58 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Search Question
Message-Id: <dqj9tb.tc.1@news.isolution.nl>

Reinhard Glauber schreef:
> Dr.Ruud:
>> Reinhard Glauber:

>>> What I want to do now is, that Perl grabs 5 lines BEFORE the
>>> occurance of E-Mail.
>> 
>> Or 4 lines before:
>>   print $1 if $html =~ /(.*\n)(?:.*\n){3}E-Mail.*/;
> 
> that works [...] but what means (?:.*\n)

This is similar: /(.*\n)(.*\n){3}E-Mail.*/
Check `perldoc perlre` for the details.

-- 
Affijn, Ruud

"Gewoon is een tijger."


------------------------------

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 8860
***************************************


home help back first fref pref prev next nref lref last post