Perl in a Nutshell

Perl in a NutshellSearch this book
Previous: Reference: studyChapter 5
Function Reference
Next: Reference: substr
 

sub

sub name [proto] {block}
sub [proto] name

Declares and defines a subroutine. name is the name given to the subroutine; block is the code to be executed when the subroutine is called. Without block, this statement only declares a subroutine, which must be defined at some later point in your program. proto is a sequence of symbols that places constraints on the arguments that the subroutine will receive. See Section 4.7, "Subroutines" in Chapter 4.


Previous: Reference: studyPerl in a NutshellNext: Reference: substr
Reference: studyBook IndexReference: substr

Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.