in reply to Changing quoted strings spanning more than one line
No more testing than your sample, but the following could be considered a little cleaner:
use strict; use warnings; my @chunks = split '"', do{local $/; <DATA>}, -1; s/(?<=.)\s*\n\s*(?=.)/ /g for @chunks; print join '"', @chunks; __DATA__ "boom" hello "" bill "baz hello jock" "boom2" abc "baz2 hello2 jock2 "
Prints:
"boom" hello "" bill "baz hello jock" "boom2" abc "baz2 hello2 jock2 "
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Changing quoted strings spanning more than one line
by eyepopslikeamosquito (Archbishop) on Sep 19, 2007 at 05:47 UTC |