if (data_submitted()) { @errors = validate_data(); if (@errors) { output_errors(@errors); output_form(); } else { process_data(); } } else { output_form(); } #### push @errors, "Age not in range" if (!is_integer($age,5,100)); push @errors, "Ugly date format" if (!is_date($date,"YYYY-MM-DD")); push @errors, "Unknown image type" if (!is_file_type($uploaded_file, "image/jpeg"));