From: Eric Wong Date: Wed, 08 Jun 2016 20:38:58 GMT Subject: Re: [PATCH v4 4/6] send-email: create email parser subroutine Message-ID: <20160608203858.GA513@dcvr.yhbt.net> In-Reply-To: <20160608130142.29879-5-samuel.groot@grenoble-inp.org> Samuel GROOT wrote: > +++ b/perl/Git.pm > +sub parse_email { > + my %mail = (); > + my $fh = shift; > + my $last_header; > + > + # Unfold and parse multiline header fields When you libify, I suggest you localize $/ since $/ may be set to something other than "\n" by a caller and change the behavior of <$fh> and $fh->getline. local $/ = "\n"; > + while (<$fh>) { > + last if /^\s*$/; > + s/\r\n|\n|\r//; And, as Eric Sunshine stated: s/\r?\n$//; Explicitly localizing $/ means you wouldn't have to worry about multiple \n showing up in the line, either. And chomp/chop wouldn't work, here. Otherwise I like the move to Git.pm, thanks.