in reply to Removing linefeeds from part of a file
Methods that use <> will be most efficient but , for the sake of MTOW, here's another. To do this properly with a regex would either require you to unroll the loop or use a proper parser, but this is the sloppy version. It's more expensive, especially for a big file, but it'll work well enough and i'd feel happier not having to rely on a state toggle.
$text =~ s{DESCRIPTION(.*?)ENDDESCRIPTION} {"DESCRIPTION\n" . join(' ', split("\n",($1))) . "\nENDDESCR +IPTION"}ges;
|
|---|