Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: Can figure out a way to get File::Grep's fgrep to chomp matches

by LanX (Archbishop)
on May 14, 2017 at 00:08 UTC ( #1190244=note: print w/replies, xml ) Need Help??


in reply to Re^2: Can figure out a way to get File::Grep's fgrep to chomp matches
in thread Can figure out a way to get File::Grep's fgrep to chomp matches

I see, please try

  my @line = fmap { chomp; /^[2-6] .+$/ ? $_ : () } *DATA;  

Sorry, I don't think this interface was well designed ...

HTH :)

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

  • Comment on Re^3: Can figure out a way to get File::Grep's fgrep to chomp matches
  • Download Code

Replies are listed 'Best First'.
Re^4: Can figure out a way to get File::Grep's fgrep to chomp matches
by Lady_Aleena (Curate) on May 14, 2017 at 00:16 UTC

    It worked, however, it would not help when feeling it a list of files where one wants the line numbers and file names.

    $VAR1 = [ '2 foo', '3 bar', '4 baz', '5 qux', '6 quux' ];

    If I feed it a list of files, I get a list of everything which matches but no line numbers and file names attached. You helped a lot today! Thank you!

    No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
    Lady Aleena
      As already mentioned, I don't like this implementation, far too many surprises.

      No wonder it's version 0.02

      You could fix it probably with a leading chomp inside the fgrep, but frankly it's easier to code it the old fashioned way than to struggle with this interface.

      I don't have this module installed, sorry.

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)
      Je suis Charlie!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1190244]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2019-09-21 09:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The room is dark, and your next move is ...












    Results (271 votes). Check out past polls.

    Notices?