Here is a simple table that gives the name and location of each script and HTML file included in the collection of example files for Perl and CGI for the World Wide Web: Visual QuickStart Guide. I hope to expand this table to create hyperlinks to the examples themselves. Hope this is useful for now.
If you have any questions, suggestions, or corrections, please contact me.
The files from this chapter are in the "creating" folder.
| Page | Section | Script | HTML |
|---|---|---|---|
| 34 | Creating output for a browser | monkey.cgi | -- |
| 35 | Documenting your script | comments.cgi | -- |
| 35 | Documenting your script (Figure 2.16) | comments2.cgi | -- |
| 40 | Checking the script's syntax | badsyntax.cgi | -- |
The files from this chapter are in the "dataform" folder.
| Page | Section | Script | HTML |
|---|---|---|---|
| 46 | Creating a form | namevalue.cgi | namevalue.html |
| 47 | Creating text boxes | namevalue.cgi | namevalue.html |
| 48 | Creating password boxes | namevalue.cgi | namevalue.html |
| 49 | Creating larger text areas | namevalue.cgi | namevalue.html |
| 50 | Creating radio buttons | namevalue.cgi | namevalue.html |
| 51 | Creating checkboxes | namevalue.cgi | namevalue.html |
| 52 | Creating menus | namevalue.cgi | namevalue.html |
| 53 | Creating the submit button | namevalue.cgi | namevalue.html |
| 54 | Resetting the form | namevalue.cgi | namevalue.html |
| 55 | Using an image to submit data | zonemap.cgi | zonemap.html |
| 55 | A prettier example | mapreader.cgi | zonemapreal.html |
| 56 | Creating a link to a script | gettime.cgi | gettime.html |
| 57 | Using a link to input data to a script | getlocaltime.cgi | getlocaltime.html |
| 58 | Adding default data to a form | cityinfo.cgi | hartfordinfo.html eurekainfo.html |
The files in this section are in the "envvar" folder.
| Page | Section | Script | HTML |
|---|---|---|---|
| 60-61 | Using environment variables to parse forms | getpost.cgi | Figure 4.2: get.html Figure 4.4: post.html Figure 4.6: getpost.html |
| 62 | Your visitor's browser and platform | browser.cgi | -- |
| 63 | How did your visitor get to your page? | referpage.cgi | -- |
| 64 | Viewing all the environment variables | env_list.cgi | -- |
The files in this section are in the "input" folder.
| Page | Section | Script | HTML |
|---|---|---|---|
| 66 | Inputting data for a form or a link | parseform.cgi | testparse.html |
| 68 | Inputting data from environment variables | printbrowser.cgi | -- |
| 69 | Inputting scalar data yourself | inputself.cgi | -- |
| 70 | Inputting arrays yourself | days.cgi | -- |
| 71 | Inputting hashes yourself | chores.cgi | -- |
The files in this section are in the "scalars" folder.
| Page | Section | Script | HTML |
|---|---|---|---|
| 74 | Storing the result of an operation | storing1.cgi storing2.cgi |
-- |
| 75 | Multiplying, dividing, adding, and subtracting | taxdeduc.cgi | taxdeduc.html |
| 76 | Using more than one operator at a time | preference.cgi | -- |
| 77 | Raising a number to an exponential power | exponents.cgi | exponents.html |
| 78 | Getting the remainder of a division | modulus.cgi | modulus.html` |
| 79 | Connecting strings together | concat.cgi | concat.html |
| 80 | Repeating a string | repeat.cgi | repeat.html |
| 81 | Operating and assigning in one step | binary.cgi | binary.html |
| 82 | Incrementing (or decrementing) a variable | increment.cgi | increment.html |
The files in this section are in the "arrays" folder.
| Page | Section | Script | HTML |
|---|---|---|---|
| 84 | Getting a particular item from an array (Fig 7.2) | getday.cgi | getday.html |
| 85 | Getting a particular item from an array (Fig 7.5) | gettoday.cgi | -- |
| 86 | Splitting a scalar into an array | split.cgi | split.html |
| 87 | Modifying all the members of an array | modifyall.cgi | modifyall.html |
| 88 | Finding the length of an array | length.cgi | length.html |
| 89 | Getting multiple items from an array | arrayslice.cgi | getmultipledays.html |
| 90 | Adding items to the beginning of an array | unshift.cgi | unshift.html |
| 91 | Adding items to the end of an array | push.cgi | push.html |
| 92 | Combining two arrays | combine.cgi | combine.html |
| 93 | Removing the first item in an array | shift.cgi | shift.html |
| 94 | Removing the last item in an array | pop.cgi | pop.html |
| 95 | Replacing an item in an array | replaceone.cgi | replaceone.html |
| 96 | Replacing more than one item in an array | replacemore.cgi | replacemore.html |
| 98 | Sorting arrays | sort.cgi | sort.html |
| 99 | Reversing the order of an array's contents | reverse.cgi | reverse.html |
The files in this section are in the "conditionals" folder.
| Page | Section | Script | HTML |
|---|---|---|---|
| 106 | Creating a basic conditional statement | if.cgi | if.html |
| 107 | Adding options for false conditions | else.cgi | else.html |
| 108 | Adding multiple, independent conditions | elsif.cgi | elsif.html |
| 109 | Using unless | unless.cgi | unless.html |
| 110 | Repeating a block while a condition is true | while.cgi | while.html |
| 111 | Repeating a block while a condition is false | until.cgi | until.html |
| 112 | Executing the block at least once | dowhile.cgi | dowhile.html |
| 113 | Repeating a block a given number of times | for.cgi | for.html |
| 114 | Repeating a block for each item in an array | foreach.cgi | foreach.html |
| 115 | Nesting conditional statements | nest.cgi | nest.html |
The files in this section are in the "subroutines" folder.
| Page | Section | Script | HTML |
|---|---|---|---|
| 118 | Creating a simple subroutine | (see page 119) | |
| 119 | Using a simple subroutine | simple.cgi | -- |
| 120 | Creating a subroutine that takes input | arguments.cgi | -- |
| 121 | Calling a subroutine that takes input | arguments.cgi | -- |
| 122 | Using a subroutine's return value | return.cgi | -- |
| 123 | Setting the return value manually | manreturn.cgi | -- |
| 123 | Not setting the return value | manretBAD.cgi | -- |
| 124 | Storing subroutines in a separate file | subroutines.lib | -- |
| 125 | Calling subroutines from an external file | main.cgi | -- |
The files in this section are in the "hashes" folder.
| Page | Section | Script | HTML |
|---|---|---|---|
| 127 | Introduction | hash.cgi | hash.html |
| 128 | Getting a value by using a key | getone.cgi | getone.html |
| 129 | Getting several values using keys | getmore.cgi | getmore.html |
| 130 | Getting all of a hash's values | values.cgi | values.html |
| 131 | Getting all of a hash's keys | keys.cgi | keys.html |
| 132 | Getting each key and value in a hash (with "each") | each.cgi |
each.html |
| 133 | Getting each key and value in a hash (with "keys") | keysvalues.cgi | keysvalues.html |
| 134 | Removing key-value pairs | delete.cgi | delete.html |
| 135 | Checking to see if a key exists | exists.cgi | exists.html |
The files in this section are in the "regex" folder.
| Page | Section | Script | HTML |
|---|---|---|---|
| 138 | Finding something | match.cgi | -- |
| 139 | Finding and replacing | substitute.cgi | substitute.html |
| 140 | Seeing and using what was found | use2.cgi | -- |
| 141 | Splitting a value into pieces | splitr.cgi | splitr.html |
| 144 | Matching a single character | matchone.cgi | matchone.html |
| 145 | Matching a string of characters | sequence.cgi | sequence.html |
| 146 | Matching a character from a group | class.cgi | class.html |
| 147 | Matching a character that's not in the group | negclass.cgi | negclass.html |
| 148 | Using class shorthands | classshort.cgi | classshort.html |
| 149 | Limiting the location | anchor.cgi | anchor.html |
| 152 | Choosing how many to match: optional elements | optional.cgi | optional.html |
| 153 | Choosing how many to match: one or more | plus.cgi | plus.html |
| 154 | Choosing how many to match: multiple optional | asterisk.cgi | asterisk.html |
| 155 | Choosing how many to match: at least m and at most n | mandn.cgi | mandn.html |
| 157 | Matching one element or another | alternation.cgi | alternation.html |
| 158 | More on using what you already matched | using.cgi | using.html |
The files in this section are in the "remember" folder.
| Page | Section | Script | HTML |
|---|---|---|---|
| 164 | Storing collected data in a hidden field | hidden1.cgi hidden2.cgi |
hidden1.html |
| 168 | Sending a cookie | sendcookie.cgi | sendcookie.html |
| 170 | Setting a cookie's expiration date | expires.cgi | expires.html |
| 171 | Limiting a cookie to a domain | domain.cgi | domain.html |
| 172 | Limiting a cookie to a part of your server | path.cgi | path.html |
| 173 | Limiting cookies to secure connections | secure.cgi | secure.html |
| 174 | Reading and using a cookie | readcookie.cgi | -- |
The files in this section are in the "printhtml" folder.
| Page | Section | Script | HTML |
|---|---|---|---|
| 178 | Formatting output with HTML | formathtml.cgi formatproper.cgi |
formathml.html formatproper.html |
| 180 | Printing several lines at a time | eof.cgi | eof.html |
| 181 | Simplifying paths to images and links | base.cgi | base.html |
| 182 | Creating header and footer subroutines | header_footer.lib | -- |
| 183 | (calling header and footer subroutines) | formatwsubs.cgi | formatwsubs.html |
| 184 | Outputting a hash as a table | htmlformatting.cgi | htmlformatting.html |
| 185 | Outputting an array as a list | list.cgi | list.html |
| 187 | Formatting numbers as dollars and cents | format.cgi | format.html |
| 188 | Padding numbers | gettime.cgi | gettime.html |
The files in this section are in the "files" folder.
| Page | Section | Script | HTML |
|---|---|---|---|
| 190 | Opening a file | openfile.cgi | -- |
| 192 | Verifying file and directory operations | writetolog.cgi | writetolog.html |
| 193 | Writing to an external file | writetolog.cgi | writetolog.html |
| 194 | Getting exclusive access to a file | flock.cgi | flock.html |
| 195 | Reading data from an external file | readfromlog.cgi | readfromlog.html |
| 196 | Closing a file | (same as readfromlog.cgi) | readfromlog.html |
| 197 | Renaming a file | rename.cgi | rename.html |
| 198 | Removing a file | delete.cgi | delete.html |
| 199 | Checking a file's status | exists.cgi | exists.html |
| 200 | Accessing a directory | opendir.cgi | opendir.html |
| 201 | Reading the contents of a directory | opendir.cgi | opendir.html |
| 202 | Closing a directory | same as opendir.cgi | |
| 203 | Changing the working directory | opendir.cgi | opendir.html |
| 204 | Creating a directory | mkdir.cgi | mkdir.html |
| 205 | Changing permissions from within a script | chmod.cgi | chmod.html |
| 206 | Removing a directory | rmdir.cgi | |
| 207 | Getting ready to e-mail output | formmail.cgi | formmail.html |
| 208 | Sending output via e-mail | formmail.cgi | formmail.html |
| 210 | Eliminating extra returns | chomp.cgi | chomp.html |
The files in this section are in the "debug" folder.
| Page | Section | Script | HTML |
|---|---|---|---|
| 214 | Creating an error subroutine | sub_error.lib errortest.cgi |
-- |
| 215 | Narrowing it down by commenting it out | commentingout.cgi | -- |
| 216 | Following a variable's progress | extra_printing.cgi | -- |
The Parsing Form Input subroutine is called "subparseform.lib" and is included in the stuffed and zipped example files.
The files in this section are in the "security" folder.
| Page | Section | Script | HTML |
|---|---|---|---|
| 236 | Monitoring visitor input | referer.cgi | goodreferer.html referer.html |
| 237 | Watching what is sent to the server | system.cgi | system.html badsystem.html |
| 238 | Avoding tainted data | taint3.cgi | -- |