in reply to http upload simulating browser

$! does not contain a useful error message in this context. $! is meant for system error messages. Since the $res object neatly encapsulates the HTTP::Response from the web server, you should try printing this out instead of looking for an error message. (Technically, this isn't an application error, it's a "failure" response from a web server.)