It's quite possible that your browser does not send its user agent.
Also, what code you've shown is not a complete program, hence I cannot tell whether there is some other error. You should consider starting using CGI or CGI::Mini, which have the ->user_agent() method, which caters for other ways of passing the user agent around. For example, mod_perl likely doesn't set $ENV{HTTP_USER_AGENT}, because %ENV is process global and mod_perl can run in system threads.
|