in reply to Regexp help
Seems to me this would be quite easy to implement reading a line at a time. Just keep a flag indicating whether you should be indenting or not.
while (<>) { if ( /^Heading Here:/ ) { $_ = "\n" . $_; $indent = 1; } elsif ( /^Another Heading:/ ) { $indent = 1; } elsif ( /^End of section:/ ) { $indent = 0; } elsif ( $indent ) { $_ = " " . $_; } print; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regexp help
by Kc12349 (Monk) on Sep 16, 2011 at 19:45 UTC | |
by Anonymous Monk on Sep 16, 2011 at 20:57 UTC | |
by thewebsi (Scribe) on Sep 16, 2011 at 21:41 UTC |