Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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

by Your Mother (Archbishop)
on May 14, 2017 at 00:14 UTC ( [id://1190245]=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

chomp doesn’t return quite like that. This should work–

my @line = map { chomp; $_ } fgrep { /^[2-6] .+$/ } *DATA;

But maybe this is better–

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

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

    Here is what your suggestion returned...

    $VAR1 = [ { 'count' => 5, 'matches' => { '3' => '4 baz ', '5' => '6 quux ', '2' => '3 bar ', '4' => '5 qux ', '1' => '2 foo ' }, 'filename' => *::DATA } ];

    I am beginning to believe this module is not set up for chomping the matches until they are munged later. The reason I even started this was that the dumper data looks bad with the newlines in the data.

    No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
    Lady Aleena

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-25 16:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found