use strict; # DO NOT LEAVE OUT. use warnings; # What did I just say?! use CGI ":standard"; my $comment; $comment = param("comment") if request_method() eq "POST"; # Note, $comment could be undefined/uninitialized here # but this is similar to your logical block.