
japhy
Enthusiast
/ Moderator
Oct 21, 2000, 8:55 AM
Post #2 of 2
(4015 views)
|
Re: Match text on multiple lines.
[In reply to]
|
Can't Post
|
|
You can't do a pattern match on an array. Do it line-by-line: <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> open FILE, $file or die "can't read $file: $!"; $/ = ""; # this allows you to read in chunks at a time, where a chunk is data between 2 or more newlines while (<FILE> ) { last if /^\[Macro\].*Value=(.):/s; } close FILE; $drive = $1; </pre><HR></BLOCKQUOTE> You need the 's' modifier at the end of the regex to allow the '.' to match ALL characters (usually, it won't match \n). Read up on perldoc perlre, or even perldoc perlretut if you need a tutorial. ------------------ Jeff "japhy" Pinyan -- accomplished author, consultant, hacker, and teacher
|