|
|
| Think about Loose Coupling | |
| PerlMonks |
Re: multi-line parsingby Nkuvu (Priest) |
| on Mar 31, 2009 at 18:40 UTC ( #754499=note: print w/ replies, xml ) | Need Help?? |
|
The while (<INF>) only reads one line at a time (where a "line" is defined by the input record separator, $/ which is a newline by default). Since you're only pulling in one line at a time, you'll never match across multiple lines. You need to reset the record separator. For example:
Note that due to the regex, only the first and third numbers will be output. You could also set the record separator to "First line of text", but keep in mind that you'll need to remove that bit from the regex:
Added: You could also undef the separator and match globally:
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||