Perl Compare Scalars

[Solved] Perl Compare Scalars | Perl - Code Explorer | yomemimo.com
Question : perl compare scalars

Answered by : charlesalexandre-roy

# Basic syntax:
| Comparison Test | Numeric | String |
|:---------------------:|:-------:|:------:|
| Equal | == | eq |
| Not Equal | != | ne |
| Comparison | <=> | cmp |
| Less than | < | lt |
| Greater than | > | gt |
| Less than or equal | <= | le |
| Greater than or equal | >= | ge |
# Note, when comparing scalars ($), Perl uses different operators depending
#	on whether the scalars are numbers vs strings.
# Note, when comparing strings, Perl compares them character by character
#	using their ASCII values (so e.g., "B" is greater than "A" and "AAA")

Source : https://www.perltutorial.org/perl-operators/ | Last Update : Thu, 10 Mar 22

Answers related to perl compare scalars

Code Explorer Popular Question For Perl