http://qs321.pair.com?node_id=754495


in reply to multi-line parsing

Your multi-line regex is failing because you are comparing against a single line, not multiple lines. By default, Perl treats a new line as the record delimiter and so each time you loop you read in only one line, i.e. just "First line of text\n" or just "Second line of text\n" and so on - so your regex never matches.

For your above code to work, you will need to either (a) choose a different record delimiter by setting the $/ variable (see the section on $INPUT_RECORD_SEPARATOR in perlvar) or (b) by defining a variable to store and concatenate the lines you read in. Then you can compare your regular expression against that variable.

Does your data have a record delimiter other than a newline? Perhaps you could post a sample of the data you are tring to parse?

Best, beth