Relational Operators

Perl has two classes of relational operators. One class operates on numeric values, the other on string values, as shown in Table 3.5.

Table 3-5. Relational Operators

NumericStringMeaning
>gtGreater than
>=geGreater than or equal to
<ltLess than
<=leLess than or equal to

These operators return 1 for true and "" for false. Note that relational operators are nonassociating, which means that $a < $b < $c is a syntax error.

In the absence of locale declarations, string comparisons are based on the ASCII/Unicode collating sequences, and, unlike in some computer languages, trailing spaces count in the comparison. With a locale declaration, the collation order specified by the locale is used. (Locale-based collation mechanisms may or may not interact well with the Unicode collation mechanisms currently in development.)

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset