Validating user input in perl

Rated 3.97/5 based on 596 customer reviews

Web services have to deal with incoming data from a POST, PUT or PATCH request that are usually in the popular Java Script Object Notation (JSON) format.

Let’s look at a couple of approaches one can take to validate the incoming JSON.

Hashes are un-ordered and you access a value using a key which is a string.

validating user input in perl-53

This really simplifies the entire process of trying out a schema.

Each value can be either a number, a string, or a reference. Hashes, like other Perl variables, are declared using the ) sign.

Arrays are ordered, and you access an element of an array using its numerical index.

If you wrote a Perl script, for example, your users can run the script on the command line using perl

They can also pass any command line arguments like this perl -a --machine remote /etc.

Leave a Reply