icon Top 9 categories map      RocketAware > Perl >

Symbolic Unary Operators

Tips: Browse or Search all pages for efficient awareness of Perl functions, operators, and FAQs.



Home

Search Perl pages


Subjects

By activity
Professions, Sciences, Humanities, Business, ...

User Interface
Text-based, GUI, Audio, Video, Keyboards, Mouse, Images,...

Text Strings
Conversions, tests, processing, manipulation,...

Math
Integer, Floating point, Matrix, Statistics, Boolean, ...

Processing
Algorithms, Memory, Process control, Debugging, ...

Stored Data
Data storage, Integrity, Encryption, Compression, ...

Communications
Networks, protocols, Interprocess, Remote, Client Server, ...

Hard World
Timing, Calendar and Clock, Audio, Video, Printer, Controls...

File System
Management, Filtering, File & Directory access, Viewers, ...

    

Symbolic Unary Operators

Unary ``!'' performs logical negation, i.e., ``not''. See also not for a lower precedence version of this.

Unary ``-'' performs arithmetic negation if the operand is numeric. If the operand is an identifier, a string consisting of a minus sign concatenated with the identifier is returned. Otherwise, if the string starts with a plus or minus, a string starting with the opposite sign is returned. One effect of these rules is that -bareword is equivalent to "-bareword".

Unary ``~'' performs bitwise negation, i.e., 1's complement. (See also Integer Arithmetic.)

Unary ``+'' has no effect whatsoever, even on strings. It is useful syntactically for separating a function name from a parenthesized expression that would otherwise be interpreted as the complete list of function arguments. (See examples above under Terms and List Operators (Leftward).)

Unary ``\'' creates a reference to whatever follows it. See the perlref manpage. Do not confuse this behavior with the behavior of backslash within a string, although both forms do convey the notion of protecting the next thing from interpretation.


Source: Perl operators and precedence
Copyright: Larry Wall, et al.
Next: Binding Operators

Previous: Exponentiation



(Corrections, notes, and links courtesy of RocketAware.com)


[Overview Topics]

Up to: Integer math




Rapid-Links: Search | About | Comments | Submit Path: RocketAware > Perl > perlop/Symbolic_Unary_Operators.htm
RocketAware.com is a service of Mib Software
Copyright 2000, Forrest J. Cavalier III. All Rights Reserved.
We welcome submissions and comments