Skip to content

Instantly share code, notes, and snippets.

@purplefoot
Created August 26, 2012 14:49
Show Gist options
  • Save purplefoot/3480630 to your computer and use it in GitHub Desktop.
Save purplefoot/3480630 to your computer and use it in GitHub Desktop.
Write only Perl code
sub flatten_header {
my $msg = shift;
for (my $i = 0; $i <= scalar(@{$msg}) ; $i++) {
last if @$msg[$i] =~ /^\n/;
if (@$msg[$i] =~ /^\s+(.*)/) {
chomp @$msg[$i-1];
@$msg[$i-1] .= " $1\n";
splice (@$msg, $i--, 1);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment