in reply to Finding part of a file
I would suggest to play around with the $/ variable (i.e. line seperator). You can do it like this.
use strict; use warnings; { local $/=""; <DATA> =~ /banana\n(.*)\ngrape\n/s; print $1; } __DATA__ apple banana pear peach grape orange
The local is not needed in this case, but it is a good habit to use it since you are resetting perl internal
variables.
This prints
pear peachI hope this helps,
---------------------------
Dr. Mark Ceulemans
Senior Consultant
IT Masters, Belgium
- Comment on Re: Finding part of a file
- Download Code
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Finding part of a file
by strat (Canon) on Dec 04, 2001 at 18:28 UTC |