[Update: GrandFather beat me to it.]
This might be a good place to make use of the flip-flop operator. It can help you avoid the ugly $start / $end / $started variables to keep track of where you are:
use strict;
use warnings;
while (<DATA>){
# Returns true after matching "LV Name",
# and returns false after
# matching "--- Logical extents ---".
if (/^LV Name/ .. /--- Logical extents ---/){
print "$_";
}
}
__DATA__
Line above
--- Logical volumes ---
LV Name /dev/vg00/lvol3
VG Name /dev/vg00
LV Permission read/write
...
--- Logical extents ---
Line below
Output:
LV Name /dev/vg00/lvol3
VG Name /dev/vg00
LV Permission read/write
...
--- Logical extents ---