Functions

Functions can be called without arguments

Some functions need not receive any arguments, and are invoked as:
function_name();

Example #6

In a program that creates HTML files, you can write special functions that print the top (head) and bottom of the files.
sub print_head {
   print FILE "<HTML><HEAD><TITLE>Programming Course\n",
              "</TITLE></HEAD><BODY>\n";
   return;
}

sub print_end {
   print FILE "<HR><A HREF="index.html">Back to Home Page</A>\n",
              "</BODY></HTML>\n";
   return;
}
These functions may be invoked as the following:
print_head ();

# code to print body of page

print_end ();

Table of Contents. Previous.