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

Difference between revisions of "Perl/Basics/Boolean Logic/Operators/Mathematical"

From NetSec
Jump to: navigation, search
(Created page with "* '''=''' 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. * '''!''' ...")
 
(No difference)

Revision as of 02:07, 19 July 2012

  • =

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