@ans = `grep '$user_field' some.file`;
is insecure?
Yes! It's very
dangerous! Imagine if $user_field contains:
An equivalent to the above command is:
if (open (GREP, "-|")) {
@ans = <GREP>
} else {
exec ("/usr/local/bin/grep", $user_field, "some.file")
|| die "Error exec'ing command", "\n";
}
close (GREP);