IT SOLUTIONS
Your full service technology partner! 
+Expand
   ► KBTo/From GuidesPerl  Print This     

Unary Operators (Perl and C++ Cross Reference Guide)

By Mike Prestwood

Perl versus C++: A side by side comparison between Perl and C++.

 
Operators
 

A language symbol used for assignment, comparison, computational, or as a logical.

Unary Operators

[Other Languages] 

General Info: Unary Operator

An operation with only one operand (a single input). Common unary operators include + plus, - minus, and bitwise not. Some operators can function as both unary and binary operators. For example, + and - operators can serve as either.

Languages Focus

What unary operators are supported in additoin to the standard plus, minus, and bitwise not.

Perl: 

An operation with only one operand (a single input). The following are the Perl unary operators: !, -, ~, +, \, &, and *.

  • ! performs logical negation which is "not"
  • - performs arithmetic negation if the operand is numeric.
  • ~ performs bitwise negation, that is 1's complement.
  • + has no semantic effect whatsoever, even on strings.
  • \ creates a reference to whatsoever follows.
  • & Address of operator.
  • * Dereference address operator.
C++: 

An operation with only one operand (a single input) such as ++X and --Y.

More Info / Comment












Sales Website: www.prestwood.com Or visit our legacy sales site: 
legacy.prestwood.com


©1995-2025 Prestwood IT Solutions.   [Security & Privacy]