jptxs has asked for the wisdom of the Perl Monks concerning the following question:
monks, my goal is to grab a web page, go through the HTML, match something on one line, grab the next five lines including the one that matched and parse those in order to construct and send an email. Grabbing the page, making the match, parsing the results and sending the email I know how to do (or, at least, I have done bfore (; ). My trouble is telling my program to match the one line, and then grab exactly four more, and then stop. I have no code to post as of yet - just playing with pseudo-code so far for this. I was thinking I could set a varible something like a counter, make it true on the first match, and then short circuit the loop when it hits five, but doing that is not happening for me.
am i on the right track? Should I be doing something else here?
-- I'm a solipsist, and so is everyone else. (think about it)
p.s. this is sort of an exercise for me to learn the LWP module and more about regex - I'm sure there are a million modules which would do all this for me, but that wouldn't really teach me a darned thing now would it? :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: grabbing N lines after matching one?
by mdillon (Priest) on Sep 16, 2000 at 20:46 UTC | |
|
Re: grabbing N lines after matching one?
by cianoz (Friar) on Sep 16, 2000 at 21:21 UTC | |
|
Re: grabbing N lines after matching one?
by fundflow (Chaplain) on Sep 16, 2000 at 20:48 UTC | |
|
RE: grabbing N lines after matching one?
by jptxs (Curate) on Sep 16, 2000 at 20:50 UTC | |
by mdillon (Priest) on Sep 16, 2000 at 21:02 UTC | |
by jptxs (Curate) on Sep 16, 2000 at 21:07 UTC | |
|
Re: grabbing N lines after matching one?
by BastardOperator (Monk) on Sep 16, 2000 at 20:55 UTC |