many thanks...

>
> >$/ = '';
>
> Set $/ to undef instead.
>
> >while(<MYFILE>) {
> >     if (m/(p1)*.(p2)/ms) {
> >             print "match! I found $1 and $2\n.";
> >     }
> >}

....this does work, but...

>
> When $/ is "", it's like the regex /\n{2,}/.

....wouldn't this have worked before, since the pattern was p1\n\np2? (2
newlines)

>  If it's undef, then <FILE>
> slurps the entire file at once.
>

OK, but with $/ undef'd the code now finds just a single instance of the
match.

If I do (for example) "p1 p2 p1 p2\n\np1 p2", shouldn't the while loop match
on 3 instances? If not, what should I use to match each instance?

Again, my goal is to match each instance of /(p1)*anything*(p2)/.

thanks again!

dn



> --
> Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
> RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
> ** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
> <stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
> [  I'm looking for programming work.  If you like my work, let me know.  ]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to