in reply to How to read lines between specific character
Assuming you mean between the first ENERGY and the last ENERGY,
while (<>) { if (/\bENERGY\b/) { ++$energy; if ($energy == 1) { $start = $.+1; } else { $end = $.; } } } say $energy; say $energy >= 2 ? $end-$start : 0;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to read lines between specific character
by AG87 (Acolyte) on Nov 13, 2010 at 18:50 UTC |