Example 6-3 is another program that uses subroutines. You'll also use the command line to give the program information it needs (such as filenames, or strings of DNA) without having to interactively answer the program's prompts. This is useful if you're scheduling a program to run at a time when you won't be there, for instance.
Example 6-3 also shows a little more about using arrays. You'll see how to use subscripts to access a specific element of an array.
For command-line programs, you type the name of the program, followed by the arguments to the program, if any, and then hit the Enter (or Return) key to start the program running. In Example 6-3, when the user types the program name, she follows that with the argument, which, in this case, is just the string of DNA in which she'll count the G's. So the program is called and returns an answer like so:
% perl example6-3.pl AAGGGGTTTCCC The DNA AAGGGGTTTCCC has 4 G's in it!
Of course, many programs come with a graphical user interface (GUI). This gives the program some or all of the computer screen and usually includes such things as menus, buttons, and places to type in values to set parameters from the keyboard.
However, many programs are run from a command line. Even the newer Mac OS X, which is built on top of Unix, now provides a command line. (Although most Windows users don't use the MS-DOS command window much, it's still useful, e.g., for running Perl programs.) As already mentioned, running ...