in reply to Can figure out a way to get File::Grep's fgrep to chomp matches
fmap { chomp; lc; }
hence there is no other way than doing the obvious
my @line = map { chomp } fgrep { /^[2-6] .+$/ } *DATA;
This should do too
my @line = grep { /^[2-6] .+$/ } fmap {chomp} *DATA;
HTH
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!
The usual trick to include the grep condition into map is left as exercise. ;)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Can figure out a way to get File::Grep's fgrep to chomp matches
by Lady_Aleena (Priest) on May 14, 2017 at 00:01 UTC | |
by Your Mother (Archbishop) on May 14, 2017 at 00:14 UTC | |
by Lady_Aleena (Priest) on May 14, 2017 at 00:19 UTC | |
by LanX (Saint) on May 14, 2017 at 00:08 UTC | |
by Lady_Aleena (Priest) on May 14, 2017 at 00:16 UTC | |
by LanX (Saint) on May 14, 2017 at 00:50 UTC |