while( ( $key, $value) = each %form ) { push @missing_params, $key if $value eq ''; } if( scalar @missing_params ) # ...