in reply to grep for array-of-strings from an array-of-strings
my $test = construct_regex (@searcharray); my @results = grep { /$test/ } @longarray; sub construct_regex { my $regex = "^"; foreach my $subregex (@_){ $regex .= "(?=.*" . $subregex . ")"; } qr/$regex/; }
|
|---|