| A routine or
subroutine also referred to as a function, procedure,
and subprogram is a portion of code that may be called and executed
anywhere in a program. For example, a routine may be used to save a
file or display the time. Instead of writing the code for these
commonly performed tasks, routines are made and called when these
tasks need to be performed. Below is a basic example of a Perl
subroutine.
&hello;
sub hello {
print "Hello World!\n";
}
In the above example, a user could call the "hello"
subroutine (in this example, by typing "&hello;")
anywhere within the program and have the program print "Hello
World!".
Also see: Call, DLL,
Function,
Programming
definitions, Stubroutine
|
|
| Resolved | Were you able to locate the answer to your questions? |
|
|