Obscuring Addresses
Let's say you have a list of names and addresses one per line like so:
John Doe 123 Orange St, Big City, GA 92034
Jane Smith 1024 5th St. #129, Small Town, NH 61923
You wish to randomly modify/obscure them to protect people's privacy (or just for the fun challenge of it!).
Do it like this: For each number in the line pick one of the digits
in the number and replace it with a different digit. Don't use a 0 for
the first digit in a number as that would look funny. After processing,
the above lines might look like this:
John Doe 128 Orange St, Big City, GA 96034
Jane Smith 1022 8th St. #729, Small Town, NH 61903
The California Election Process
For statewide elections California uses a "random alphabetic"
sort of candidates' names. This link describes that special sort:
http://www.ss.ca.gov/elections/elections_ra.htm
A suggested design is this:
% perl elect.pl [-r] namefile
The file 'randlet.txt' will contain
a random permutation of the 26 letters of the alphabet.
If this file does not exist the program will generate it.
The -r option will force the file to be regenerated.
The candidate names come from a filename on the command line.
The names come one per line with first name then last name.
Jill Harmon
Gus Tribble
Walter Reston
Norma Kretschmer
For output, first print the permutation of the 26 letters.
Then get into a loop asking for district numbers.
Print out the order of candidates for that district.
Sort the candidates names (using the special random alphabetic sort)
by last name and then by first name.
Time Sheet
When I do hourly contract work I keep my time in a plain
text file with this format:
Jan 13 12:00-1:30, 2:15-4:35
did work on the parsing of the
input file.
finalized the parsing, read about HTML,
cleaned up the data.
Jan 15 4:50-6:25
finished up the testing
Lines that don't begin with a space/tab are date/time lines
in a well defined format. Indented lines are comments on what
I did during those times.
Since time arithmetic is rather tricky I made a Perl script
to help. It parses the file and prints a tally of the time spent.
Optional command line parameters would be for the hourly rate to determine
the total earned. Format it nicely. Worry about time ranges
that cross noon/midnight - like this:
Feb 14 11:45-1:35
Created the database tables.
Assume that one would not work more than
12 hours in a row.
Buzzword Bingo
See this site:
http://www.logicalpoetry.com/cgi-bin/gencard.cgi
Note that each time the page is reloaded you get a
different Bingo card. The words are chosen randomly (but not
duplicated).
You do not need to make a CGI program.
Just generate an HTML file that can be loaded into the browser.
The words in the squares could come from a list in a file.
Tk
A simple Tk 'game'.
Learn enough about Tk to generate simple buttons.
Make a game that generates a quit button that
generates even more quit buttons. A special hidden
clue will tell you which button will really quit.
Or do something else simple.
CGI
Learn enough about CGI to process a simple form.
Do it with the tiny web server.
See the class web site for an introduction to CGI.
Simple dictionary lookup
Either with LWP:Simple to a dictionary site (and then parsing the HTML)
or by using the public domain dictionary files from:
http://www.gutenberg.org
A Favorite CPAN Module
Peruse CPAN for some module you find interesting
and make a project using that module. Installing that
module might prove a challenge - depending on whether
ActiveState has done it for you or not. Or whether
it is a pure Perl module or not. See the class
web site for how to use ActiveState's ppm (Perl Package
Manager) command.
Any other project you have in mind.
It should be larger and more challenging than the homework
you have been doing. I'm open to suggestions!
It is always better if a project has personal relevance
to you.