Questions about this topic? Sign up to ask in the talk tab.

Perl/Basics/Boolean Logic/Operators/Mathematical

From NetSec

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
  • =

The = operator assigns a value to a variable.

  • ==

The == operator is used to test if a variable is equal to a value or another variable.

  • !

The ! operator means "not". It applies to = and any variable. For example, "if (!$scalar)" is used to determine if the $scalar variable is null, zero, or undefined. When used before a = operator, this becomes "not equal to".

  • eq

Sometimes because variables may not be a string or integer, the eq operator is used to determine if the two are equal.

The following operators are used for greater than, less than, and greater than or equal to, less than or equal to, etc; similar to other languages:

  • >
  • gt
  • <
  • lt
  • >=
  • gte
  • <=
  • lte