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);
In reply to Re^2: grep with looped tests
by RichardK
in thread grep with looped tests
by Wiggins
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |