in reply to CGI hidden input value wrongly assigned.

Check your conditionals and make sure nothing is executing that you think isn't. I just copied your above code:
use CGI qw/:standard/; $thisscript = 'foo'; print p("line 109"); print start_form({ -action => "$thisscript", -method => "post" }); print hidden('action','logout'); print submit('Logout'); print end_form; print p("line 115");
When I ran, I got the expected result:
<p>line 109</p><form method="post" action="foo" enctype="multipart/for +m-data"> <input type="hidden" name="action" value="logout" /><input type="subm +it" name="Logout" value="Logout" /></form><p>line 115</p>
So something is running that you think isn't.