in reply to Perl 500 error

Most likely the perl binary that root runs is not the same Perl binary that your webserver starts.

Try

which perl

to find out which Perl your shell would call for root.