Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^7: My problems to understand the Perl documentation (Terminology)

by LanX (Saint)
on Aug 24, 2020 at 19:46 UTC ( [id://11121057]=note: print w/replies, xml ) Need Help??


in reply to Re^6: My problems to understand the Perl documentation
in thread My problems to understand the Perl documentation

In my book

  • (named) function something of the form Name(Args) usable as EXPR, that means returning a value at runtime. Parens can be omitted if precedence is clear. Arguments - if any - must follow to the right, either as one UNARY value or as comma separated LIST.
  • builtin : a named function in the language core. The name is a reserved keyword. Some may have special parsing rules for arguments and special context, such that they can't be replicated with sub (PROTOTYPE) { BLOCK }
  • operator symbols acting like functions by returning values but with "surrounding" (not necessarily following) arguments, special parsing and precedence like 2 * 3 . See perlop and overload
  • named operators like xor have an alphanumeric IDENTIFIER as "symbol". NB: some builtin functions are sometimes documented as "operators" (it's just a huge subgroup with a more standard syntax)
  • statement keywords anything requiring void context. I.e. can't be used in an expression (without do ). It usually follows a semicolon and is used for side-effects . Most at compile time like like use
  • Some of them are documented as "function-like keywords" because they parse like functions like my but are primarily used for declaration (a compile time side effect)

Please expand/correct me. ..

EDIT

N.B. some keywords fall into multiple categories, depending on usage.

sub name { Block } is a statement declaring a subroutine at compile time.

$code = sub { Block }; is a builtin function returning a coderef at runtime.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11121057]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-25 02:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found