in reply to Re: matching lines in multi-line string
in thread matching lines in multi-line string

Wrong. This will give you an array of substrings that were matched by the pattern. The requirement is to get the lines that match the pattern.

You could change it to

@patternMatchArray = $lines =~ /^.*pattern.*$/mg;

But it doesn't seem like a good solution to me, though I can't put my finger on exactly why not...

--
3dan

Replies are listed 'Best First'.
Re: Re: Re: matching lines in multi-line string
by Roger (Parson) on Nov 27, 2003 at 19:11 UTC
    Well, doesn't this look rather like a homework question to you??? Of course I know that solution doesn't solve the problem. I was just giving him an idea of how to tackle the problem, not to give him a staight answer. I think OP is doing it that way (using slurp and regular expression) for a reason. ;-)