According to your error messages, I suspect the
exec bit is not turned on, do: chmod +x test.pl
(or whatever is required so the apache User has permissions
to run it.)
I would also uncomment CGI::Carp until things work, just to ensure
that test.pl is compilable.
Comment on Re: Premature end of script headers error