my %param= map($_ => 1) $template->query(); if (exists $param{'temperature'} or exists $param{'cloud_cover'}) { # The weather code goes here }