October 2001
Beginner
1024 pages
25h 8m
English
The following script (see Listing 21.1) doesn't really do anything useful except to use as many of the techniques as possible that we've covered so far, including some we haven't. This script is available on the included CD-ROM as simpledemo.pl.
#!/usr/bin/perl # <STDIN> is an I/O handle referring to the standard input. In this context, # we're using it to read in text input from a prompt. The chomp operator removes # any trailing newline/return characters from the end of the input. print "Please enter your name: "; chomp ($name = <STDIN>); srand; # Initialize the random number generator @namelist = ("Bob","Jane","Frank"); @colorlist = ("green","red","blue","yellow"); ... |
Read now
Unlock full access