many thanks~~ it's quite clear in the perldoc and the problem is solved. :)



2006/8/7, John W. Krahn <[EMAIL PROTECTED]>:

Guo Remy wrote:
> hi all,

Hello,

> i'm now trying to match a number of lines in a txt file...for example,
my
> txt file is:
>
> abc
> xyz
> fred
> wilma
> barney
> anything
>
> and my code is:
>
> while (<>)  {
>    if (/(fred\nwilma\n\barney)/)  {
>        print "$1\n";
>    }
> }
>
> but actually it returns nothing...i guess "while (<>)" reads the file
line
> by line, so it can not match several lines at a time...right?
>
> so how can i match multiple lines in a file?
> thanks in advance~~ :)

perldoc -q "matching over more than one line"



John
--
use Perl;
program
fulfillment

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Reply via email to