--#--
Wha'd I say?
--#--
One reason Perl has become so universal in CGI programming for the
Web is its flexible and powerful regular expression parsing.
Here's an example that probably cannot be duplicated by any other
language in as few lines of code.
Let's say you need to stuff a user's data from a Web form back into
the HTML form's fields. Why would you want to do this? Maybe you're
displaying a "Confirm" page at the end of a lengthy, multi-page form.
You want the user not only to confirm the data, but be able to change it
if necessary.
Or, and too few Web sites do this, you're correcting a user's input.
She entered digits in a name, or left a required-field blank. Ordinarily,
what most sites do is put up an "Error" page and tell the user to go
back and fix the error. If you rely on the browser's "Back" button to
take them back, you're operating on blind faith that the data will still
be available in the browser's cache. If not, well... too bad.
Much better to re-populate the fields programatically with your CGI
script. To do this, you'll need a good set of regexes. And here they are ...