![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
sub NAME {
STATEMENTS;
}
&NAME(arg1,arg2,etc); # - or - (if the subroutine takes no arguments. &NAME; # return values are used just like anyother value $loudestInstrument = &measureLoudest(@allInstruments);
# define an error routine:
sub error {
($message) = @_;
print("<b>ERROR:<b>",
$message,
"<p>Contact the author of the previous page for assistance\n");
exit(0);
}
if ( ! $recipient ) {
# the form did not have a to field
# modify this text appropriately
&error("No Return Address");
}
Note how the definition of the subroutine doesn't affect the flow of
our program.
![]()
The National Center for Supercomputing Applications
University of Illinois at Urbana-Champaign
[email protected]
Last modified: June 19, 1997