home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


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: study Perl in a Nutshell Next: Reference: substr
Reference: study Book Index Reference: substr

Library Navigation Links

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