David Newman wrote: > > Consider a file containing this pattern: > > p1 > p2 > > I can match for p1 and p2 like this: > > $/ = '';
perldoc perlvar You are setting $/ to paragraph mode which is why the second example doesn't work. > while(<MYFILE>) { > if (m/(p1)*.(p2)/ms) { ^^ ^^ *. should be .* or .*? The /m option is not required as you are not using ^ or $ to anchor a line. > print "match! I found $1 and $2\n."; > } > } > > However, the match fails if I change the pattern to: > > p1 > > p2 > > What I would like to do is match (p1)any arbitrary amount of junk, including > 0 or more newlines(p2) John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]