Equality Operators
Previous  Top  Next

Strings: To compare string values, you would either use eq or ne. Example:

if ($password eq "Quicksie") { print "PWD OK" }
if ($password ne "Quicksie") { print "ACCESS DENIED" }

Of course it would make more sense to use else here, but for the sake of examples be happy with this solution.

Numbers: To compare numbers, use <, <=, >, >=, <> and ==.

Example:

if ($number > 10) { print "Wow ..." }
if ($number == 3) { print "You are correct" }