Документация
HTML CSS PHP PERL другое

Section B.8.  Chapter 9, Subroutines

 
Previous
Table of Contents
Next

B.8. Chapter 9, Subroutines

  • Call subroutines with parentheses but without a leading &. [Call Syntax]

  • Don't give subroutines the same names as built-in functions. [Homonyms]

  • Always unpack @_ first. [Argument Lists]

  • Use a hash of named arguments for any subroutine that has more than three parameters. [Named Arguments]

  • Use definedness or existence to test for missing arguments. [Missing Arguments]

  • Resolve any default argument values as soon as @_ is unpacked. [Default Argument Values]

  • Always return scalar in scalar returns. [Scalar Return Values]

  • Make list-returning subroutines return the "obvious" value in scalar context. [Contextual Return Values]

  • When there is no "obvious" scalar context return value, consider Contextual::Return instead. [Multi-Contextual Return Values]

  • Don't use subroutine prototypes. [Prototypes]

  • Always return via an explicit return. [Implicit Returns]

  • Use a bare return to return failure. [Returning Failure]

    Previous
    Table of Contents
    Next
    © 2000- NIV