unless ($query->param('loc')) { # print error mesage or whatever. } #### if ($query->param('loc) eq '') { ... }