Are strict and warnings on? My first reaction would be that $passwd may be empty (maybe you declared $password)... other than that, if you're using single quoted declarations... things such as @ or $ in your password shouldn't be an issue. Sorry for stating the obvious.. but I tested this code fine on Win32 to Solaris 8.
I do have strict on, not warnings, though. My declarations are correct. I'll try warnings and see if that sheds any light. Warnings found a couple of unrelated issues, no change, of to see if dump_log sheds any light.