Whenever I need matches over multiples lines I generally read the text into
one string (assuming its not too large) and then just match over newlines:

$foo = "some input text with newlines..."
@matches = $foo =~ /some pattern/sg;

read up on the modifiers (s will match newlines), adjust your patten and you
should be set.

----- Original Message ----- 
From: "Beckett Richard-qswi266" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, July 11, 2003 10:19 AM
Subject: Foreach question.


> Guys,
>
> This is one I don't know how to approach at all.
>
> I've read a text file into @lines.
> I then process it like this...
>
> foreach (@lines) {
> last if /Next section$/;
> next unless (/match$/);
> chomp;
> process $_;
> }
>
> My data is random, but in this form:
>
> A line I want data from ending in match
> http://some.link/
>
> A line I don't want data from ending in something else
> http://some.other.link/
>
> ...
>
> A line I do want data from, light a match
> http://whatever
> ...
>
>          Next section
>          ============
>
>
>
> Everything was working fine, I was pulling out the required data, and
doing
> what I wanted with it.
>
> Unfortunately, now "they"'ve decided that they want me to process the url
on
> the next line as well as the first line, but only provided the line before
> matches.
>
> I have no idea where to start with this. Is it possible to pull 2 lines at
a
> time from @lines, or something?
>
> Thanks.
>
> R.
> _______________________________________________
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to