Sharing

2013年5月27日 星期一

Perl 語言編程第四版筆記(二)

Chapter 5 Pattern Matching


Skip first for time reason.

Chapter 6 Unicode


Skip first for time reason.

Chapter 7 Subroutines



sub NAME BLOCK
sub NAME PROTO ATTRS BLOCK
sub NAME BLOCK
sub NAME PROTO ATTRS BLOCK

To create an anonymous subroutine or closure, leave out the NAME.

To call subroutines directly,
NAME(LIST) # & is optional with parentheses.
NAME LIST # Parens optional if sub predeclared/imported.
&NAME # Exposes current @_ to that subroutine,

To call subroutines indirectly (by name or by reference)
&$subref(LIST) # The & is not optional on indirect call
$subref–>(LIST) # (unless using infix notation).
&$subref # Exposes current @_ to that subroutine.










沒有留言: