On Mon, 17 Mar 2003 00:52:21 +0100 (MET), Louis Pouzin wrote: >The intent is to catch all text from a line and its continuation if any (in msg >headers).
Here's another approach that does basically that same thing: @headers = split /\n(?![\ \t])/, $headers; It splits on newlines (while deleting them) except when they're followed by blanks (as per R. Kimball: spaces and tabs) You can further process the result for example like this: foreach(@headers) { my($key, $value) = split /:\s*/, $_, 2; print "HEADER: $key\n\t$value\n\n"; } Alternatively, you can first unfold the headers, and next split on newlines: $headers =~ s/\n[\ \t]+/ /g; @headers = split /\n/, $headers; -- Bart.