Either it's detecting that your user agent is weird (most do not start with "User-Agent="), or there's javascript in the form which is setting (or removing) fields during a normal submission via a browser. Try filling out the login form in a browser and observing what is actually posted (via Firebug, etc), and updating your script to match. Alternatively, use a web scraping library which can run javascript, such as WWW::Mechanize::Firefox.
I am assuming, of course, that you have permission to be doing this. Some people have good reasons for not wanting bots on their site.