Validating number in perl
Forcing a numeric value to a particular format does not change the number stored in the value.
All the operators which need an argument in the integer format treat the argument as in modular arithmetic, e.g., Though forcing an argument into a particular form does not change the stored number, Perl remembers the result of such conversions.
Operator overloading allows user-defined behaviors for numbers, such as operations over arbitrarily large integers, floating points numbers with arbitrary precision, operations over "exotic" numbers such as modular arithmetic or p-adic arithmetic, and so on. Perl can internally represent numbers in 3 different ways: as native integers, as native floating point numbers, and as decimal strings.
Decimal strings may have an exponential notation part, as in .
If the values are equal, the test returns true, and if the values are not equal, the test returns false.
This document describes how Perl internally handles numeric values.
Perl's operator overloading facility is completely ignored here.
There are a variety of comparison operators you can use to determine the logical flow of your Perl programs.
We've already discussed the difference between the Perl numeric comparison operators and the Perl string comparison operators, which can cause some confusion to new Perl programmers.