develooper Front page | perl.perl6.language | Postings from November 2002

[RFC] Perl Operator List, TAKE 6

Thread Next
From:
Michael Lazzaro
Date:
November 1, 2002 12:20
Subject:
[RFC] Perl Operator List, TAKE 6
Message ID:
8964D98F-EDD7-11D6-8B40-00050245244A@cognitivity.com
Adjusted for the most recent notes: includes «op» as the preferred (and 
possibly only) spelling of "vectorize".  Everything but a few hyperop 
issues appears to be close to final, by my count: if/when Larry sticks 
a fork() in it, it's done.

hyperoperators:

   «op»  - When used with any unary or binary operator,
            "vectorizes" the operator.
   »op«  - [maybe] same, but intersection instead of union.
   ^[op] - [maybe] synonym for «op»
         - [maybe] synonym for »op«

unary (prefix) operators:

   \     - reference to
   *     - list flattening
   ?     - force to bool context
   !     - force to bool context, negate
   not   - force to bool context, negate
   +     - force to numeric context
   -     - force to numeric context, negate
   ~     - force to string context
   ^     - complement, type-specific
   .     - method call on current topic
   .=    - method call on current topic, replaces topic

   ++    - preincrement
   --    - predecrement

unary and other postfix operators:

   These are used as postfix operators when encountered where
   an operator is expected.  No space is allowed between these
   postfixes and the elements they are operating on.

   ++    - postincrement
   --    - postdecrement

   ...   - synonym for ..Inf

   ()    - method call
   []    - array access
   {}    - hash access


binary operators:

   <      >     <=    >=    ==    !=    <=>    - comparision (numeric)
   lt     gt    le    ge    eq    ne    cmp    - comparision (string)

   +     -     *     /     %     **            - arithmetic
   +=    -=    *=    /=    %=    **=

   ~     ~=                      - string concat
   x     x=                      - string repetition
   xx    xx=                     - list replication

   &&    ||    ^^    //          - boolean operations
   &&=   ||=   ^^=   //=
   and   or    xor   err

   +&    +|    +^    <<    >>    - bitwise (integer) operations
   +&=   +|=   +^=   <<=   >>=

   ~&    ~|    ~^                - charwise (string) operations
   ~&=   ~|=   ~^=

   ?&    ?|    ?^                - C-like boolean operations
   ?&=   ?|=   ?^=               - (result is always just 1 or 0)

   &     |     ^                 - superpositional operations
   &=    |=    ^=                - conjunctive, disjunctive, exclusive
   all   any   one   none        - conj, disj, excl, dismissive

   ~~      !~                    - smart match, smart non-match

   =>    - pair creator
   ,     - list creator
   ;     - "greater comma", list-of-lists creator
   :     - adverbial
   .     - method call

    ..   - range
   ^..   - [maybe] range, exclusive of endpoint(s)
    ..^
   ^..^

   =    - assignment
   :=   - runtime binding
   ::=  - compiletime binding


trinary operator:

   ?? ::    - if/else


parens, misc, and quotelike operators:

   These may appear where a term is expected.

   ()
   []
   {}

   m//   - shorthand, "matches"
   s///  - shorthand, "substitute"
   tr/// - shorthand, "transliterate"

   '...'  "..."   `...`   /.../
     q     qq      qx      rx      qw     [qm?]

   <...>        - iteration
   (heredocs)   - [exact format unknown; probably as perl5]


magical whitespace modifier:

   _     - When used at the end of a line or between
           statement elements, acts to "remove" whitespace
           when interpreting the statement.  (Allows
           whitespace to appear without invoking any
           special interpretations normally associated
           with that whitespace.)


named unary (prefix) operators, terms, and other
important assorteds, identified when possible:

   -X       - [op] filetest operators

   ref      - [op]
   exists   - [op]
   delete   - [op]
   defined  - [op]
   undef    - [op]
   undef    - [term]
   temp     - [op]
   let      - [op]
   but      - [op] val properties

   ${ }     - [deref] dereference scalarref
   @{ }     - [deref]
   %{ }     - [deref]
   &{ }     - [deref]

   ...      - [term] yada**3
   Inf      - [term]
   NaN      - [term]

   is       - [declar] var properties
   ->       - [declar] like 'sub'
   hash     - [declar] force hash context


MikeL

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About