Creating a Subroutine
-
To create a subroutine,
-
Use the sub keyword, like the function keyword we used in JavaScript.
-
After sub, type the name of the subroutine and an open curly brace.
-
Then, type the lines of code you want the subroutine to execute.
-
Close it with a close curly brace.
sub printFooter {
# print the author line
print "<br>Authored by: Brandan Jones\n";
print "<br>jonesbl@one.net\n";
print "<br><a href = \"http://oz.uc.edu/~jonesbr\">http://oz.uc.edu/~jonesbr</a>";
}
Calling a subroutine
Home