Do you use an HTTP proxy server by any chance to access the web from your location? You need an environment variable setting up to identify the proxy server.
What is ssltest.bat? Have you converted your Perl script into a batch file? If the script is running as a batch file then you may not have the environment that you were expecting.