Validating user input in perl
Note: You do not need to do the things mentioned in this article if you have created your feedback form using the Feedback Form Script Wizard.Among other things, the script made by the wizard automatically checks for empty fields.To achieve this, an if statement is used to check for these conditions.
If not, an error message is printed to the user, and the script exits with an exit code 3.
Validating user input is a best practice to eliminate a big source of execution errors and bugs.
We have also learned how to print usage messages to tell users the purpose of the program, the expected arguments, and the available options.
If no validation is place, the bash interpreter will try to execute the division operation, and … The solution is to validate the user’s input to assure the divisor is not 0.
Otherwise, a friendly error message is printed to the user.If it's not then it calls the same sub-routine until a validating entry is matched.