What’s the Perl function that achieves the same thing as compareTo() in Java? I know about eq and ne but I want to compare to see if one string is greater than another.
What’s the Perl function that achieves the same thing as compareTo () in Java?
Share
You actually have
cmp(for strings) and<=>(for numbers) operators.See the Equality Operators section in perlop.
Example: