Validating number in perl

The confusion stems from the fact that Perl actually has two sets of comparison operators - one for comparing numeric values and one for comparing string American Standard Code for Information Interchange (ASCII) values.Since comparison operators are typically used to control logical program flow and make important decisions, using the wrong operator for the value you are testing can lead to bizarre errors and hours of debugging, if you're not careful.

validating number in perl-47validating number in perl-83

Six such conversions are possible: above involve steps performed by the C compiler.

Thus the limits for Perl numbers stored as native integers would typically be -2**31..2**32-1, with appropriate modifications in the case of 64-bit integers.

Again, this does not mean that Perl can do operations only over integers in this range: it is possible to store many more integers in floating point format.

The simplest and probably most used comparison operators test to see if one value is equal to another value.

If the values are equal, the test returns true, and if the values are not equal, the test returns false.

Leave a Reply