Perl has two basic types of comparisons: comparisons between text and comparisons between numbers. Remember that Perl doesn’t care whether a variable is text or a number until you use it in a manner that requires it to care.
| Text Operator | Numeric Operator | Meaning |
| eq | == | are the two items equal? |
| ne | != | are the two items unequal? |
| lt | < | does the left item come before the right item? |
| gt | > | does the left item come after the right item? |
| lte | <= | is the left item before or equal to the right item? |
| gte | >= | is the left item after or equal to the right item? |
| cmp | <=> | -1 if the left item comes first, +1 if the right item comes first, and 0 if both items are the same |