in reply to Regular Expressions Challenge
Now @section will contain all the text after ===Comments===, one chapter at a time.my @section; my $i = -1; foreach (split /\n/, $str) { if (/^===Comments===$/) { ++$i; next; } next unless $i >= 0; $section[$i] .= "$_\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regular Expressions Challenge
by danj35 (Sexton) on May 18, 2010 at 07:41 UTC | |
by JavaFan (Canon) on May 18, 2010 at 13:33 UTC |