Re: [PATCH v4 1/2] Documentation: fix linkgit references
- From
Jeff King <peff@peff.net>
- Date
- May 4, 2016, 22:11 UTC
- Message-ID
- <20160504221127.GB26339@sigill.intra.peff.net>
- In-Reply-To
- <CACBZZX4dYjHETCyMFQngBKoS80gkmcAZKKYc0VkE0ufaAg-gZg@mail.gmail.com>
On Wed, May 04, 2016 at 11:54:52PM +0200, Ævar Arnfjörð Bjarmason wrote:
Show 8 quoted lines
> > my @files = map { chomp; $_ } `git ls-files`;
>
> As a minor sidenote you can equivalently write that as:
>
> chomp(my @files = `git ls-files`);
>
> I.e. chomp itself when given a list will chomp each item of the list.
> So no need for a map.Right, thanks, that is more readable. I use the map form reflexively because I am often doing stuff like:
my @list = do {
open(my $fh, '<', $fn);
map { chomp; $_ }
};(or replacing "do" with an actual function which is returning a grotesque pipeline of grep/map, etc).
-Peff