in reply to CGI hook
Even without change, your code outputs a telling warning.
Adding use strict makes the error crystal clear.
Update: Apparently, that's not the only problem. I can't figure it out at the moment.