in reply to 500 server error with no explenation

You have a typo...easy one to miss,
.... my $query = CGI->new(); my $name = $query->cookie('username'); # was my $name2 = param('nametext'); my $name2 = $query->param('nametext'); ....
Update and all of the above kind advice from my fellow monks was better said by them than I could have said it (and faster too). EEjack