G'day Lady Aleena,
I haven't used that module before, so there may be a better way of doing this; however, the following achieves what you appear to want.
#!/usr/bin/env perl use strict; use warnings; use File::Grep qw(fgrep); use Data::Dumper; my @line = map { chomp $_ for values %{$_->{matches}}; $_ } fgrep { /^ +[2-6] .+$/ } *DATA; print Dumper(\@line); __DATA__ 2 foo 3 bar 4 baz 5 qux 6 quux 7 thingy 8 widget
Output:
$VAR1 = [ { 'count' => 5, 'matches' => { '3' => '4 baz', '4' => '5 qux', '1' => '2 foo', '5' => '6 quux', '2' => '3 bar' }, 'filename' => *::DATA } ];
— Ken
In reply to Re: Can figure out a way to get File::Grep's fgrep to chomp matches
by kcott
in thread Can figure out a way to get File::Grep's fgrep to chomp matches
by Lady_Aleena
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |