in reply to regexp match arg1 AND arg2
something like this perhaps...
@matches = map {qr/\Q$_\E/} @ARGV; while ($rec = <DATA>) { print $rec if @matches # we have something to look for and ( grep {$rec =~ $_} @matches # the number of matches found ) == @matches; # equals the number specified } __END__ Bill Gates Bill Bonko John Random Quincy Gates
$ perl test.pl Bill Bill Gates Bill Bonko $ perl test.pl Bill Bonko Bill Bonko $ perl test.pl Bonko Bill Bonko perl test.pl Gates Bill Gates Quincy Gates $ perl test.pl Gates Bill Bill Gates
|
|---|