in reply to Re: grep with looped tests
in thread grep with looped tests
Similarly, using first from List::Util to short circuit the inner loop when you match a line :)
use v5.18; use warnings; use List::Util 'first'; use Data::Dumper; my @data = 0..10; my @re = (3,7,9); my @res = grep {my $line = $_; !defined first {$line =~ $_} @re } @dat +a; say Dumper(\@res);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: grep with looped tests
by LanX (Saint) on Jun 06, 2014 at 16:03 UTC |