Author: larry Date: Wed Nov 15 09:35:04 2006 New Revision: 13478 Modified: doc/trunk/design/syn/S02.pod
Log: Clarifications on use of identifiers, names, and bare sigils. Modified: doc/trunk/design/syn/S02.pod ============================================================================== --- doc/trunk/design/syn/S02.pod (original) +++ doc/trunk/design/syn/S02.pod Wed Nov 15 09:35:04 2006 @@ -12,9 +12,9 @@ Maintainer: Larry Wall <[EMAIL PROTECTED]> Date: 10 Aug 2004 - Last Modified: 4 Nov 2006 + Last Modified: 15 Nov 2006 Number: 2 - Version: 77 + Version: 78 This document summarizes Apocalypse 2, which covers small-scale lexical items and typological issues. (These Synopses also contain @@ -955,6 +955,35 @@ =item * +And I<identifier> is composed of an alphabetic character followed by +any sequence of alphanumeric characters. The definitions of alphabetic +and numeric include appropriate Unicode characters. Underscore is +always considered alphabetic. + +A I<name> is anything that is a legal part of a variable name (not counting +the sigil). This includes + + $foo # simple identifiers + $Foo::Bar::baz # compound identifiers separated by :: + $Foo::($bar)::baz # compound identifiers that perform interpolations + $42 # numeric names + $! # certain punctuational variables + +Unlike in Perl 5, if a sigil is followed by comma, semicolon, colon, +or any kind of bracket or whitespace (including Unicode brackets and +whitespace), it will be taken to be a sigil without a name rather +than a punctuational variable. This allows you to use sigils as coercion +operators: + + print $( foo() ) + +It also allows the use of bare sigils as placeholders for anonymous variables: + + my ($a, $, $c) = 1..3; + print unless (state $)++; + +=item * + Ordinary package-qualified names look like in PerlĀ 5: $Foo::Bar::baz # the $baz variable in package Foo::Bar