#7 - if ((exists $in->{ubb}) && ($in->{ubb} !~ m/^(forum|get_topic|pntf)$/)) {
if (!exists $in{ubb}) {

I guess only the 2nd one fixes it.