cat splitest.pl #!/usr/bin/env perl use strict; use warnings; my $t = q{ Subject: Hi there Content-Type: text/plain; format=flowed; charset="iso-1189-1"; Return-Path: }; my @fields = split /\n\b/, $t; print join("\n***\n", @fields), "\n"; localadmins-MacBook-Pro-2:~ [mmason] $ perl splitest.pl *** Subject: Hi there *** Content-Type: text/plain; format=flowed; charset="iso-1189-1"; *** Return-Path: