Hey Thank you for the timely help. But now i have another problem.
My script seems to run fine from command line. but if it gets invoked by the apache server it throws internal server error. When i look into the error log this is what i get.

Is DBD::mysql installed for the version of (mod_)Perl that Apache is running? You say the script works when you run it as another user, so make sure that both users see the same Perl and the same mod_perl.

Did it pass its test suite? If you installed the module via the CPAN tool, did it pass its test suite?

Is the file C:/perl/perl/site/lib/auto/DBD/mysql/mysql.dll there?

Does the Apache user have read/execute permissions for the file and all directories above it? You seem to be running Windows, so if the Apache user is running as a service, it may or may not have the appropriate permissions to load DLLs.