in reply to Re^2: Regexp help
in thread Regexp help

This tweak adds a newline to the first heading in a series:

while ( defined (my $line = <DATA> ) ) { state $indent_char = ''; print "\n" if $line =~ m/$opening_pattern/ && ! $indent_char; $indent_char = '' if $line =~ m/$closing_pattern/; print $indent_char . $line; $indent_char = ' ' if $line =~ m/$opening_pattern/; }

Replies are listed 'Best First'.
Re^4: Regexp help
by thewebsi (Scribe) on Sep 16, 2011 at 21:41 UTC