http://qs321.pair.com?node_id=11138609

almr has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

what's an idiomatic way to match certain regions of a string (m//mg), and then for each sub-region, perform substitutions (s///mg)? I can think of several options, none of which seems appealing.

E.g. within regions delimited by "# START" / "# END", uncomment lines (s/^[ #]*//g). I could turn the string into a line-list, use the flip-flop to identify regions, and s///g for each line. But isn't there something cleaner and more general?