|
|
Perl - Define a Function - sub - Perl
|
Views : 372
|
|
Tagged in : Perl
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
Perl - Define a Function - sub
Functions work like subroutines. They can appear anywhere with the code and are only executed when called. The normal program flow will skip over subroutines. The standard method is to place them at the end of the code. All variables used within the subroutine are global unless otherwise specified. A subroutine is identified by the word 'sub', followed by the name of the subroutine. The folowing code associated with the sub must be surrounded by '{ }'s.
sub subname {
statement1;
statement2;
} |
|
By Geethalakshmi, On - 2010-09-17 |
|
|
|