@ok = `grep @opts '$search_string' @filenames`;
You have to do this:
my @ok = (); if (open(GREP, "-|")) { while (<GREP>) { chomp; push(@ok, $_); } close GREP; } else { exec 'grep', @opts, $search_string, @filenames; }
Just as with system,
when you exec
a list, so no
shell escapes happen.