Programming in Perl - CSCI 2962
Office: Lally 004
- Tues 4-5 Lally 004
- Thur 2-3, AE 217
Programming in Perl
Amos Eaton 214
Larry Wall, Tom Christiansen, & Randal L. Schwartz
Randal L. Schwartz & Tom Christiansen
- December 12th
Final grades have been submitted. You should be able to get them
from SIS tomorrow or Friday. Grade distribution for the course is
41 A's - 21 B's - 7 C's - 9 D's - 2 F's - 2 AU's - 1 I
Don't forget to pick up your midterms and/or finals from my mailbox
in AE 117 before Friday.
- December 11th
At long last, HW4 has been completed grading. All of your grades,
along with your final course grade, are now online, using the link
above. I urge you to check your grades immediately - as I will be
submitting final grades to the registrar around 2:30pm Wednesday
afternoon. If you see a discrepancy somewhere, it is VITAL that you
contact me ASAP.
- December 7th
Based on the varied answers I saw to question 4 on the first page of
the exam, it's obvious to me that the question was worded badly, and
that many people did not understand what I was asking for.
Therefore, I've made this question a bonus question as well. Anyone
who got it right earned 4 points, while those who got it wrong did
not lose anything. This is not shown on your actual exam, but is
corrected on the online grade report (ie, your online grade will be
4 points higher than the grade written on your exam).
All Final Exams have been graded. Check your grades online. If you
don't have a grade for the exam, you didn't turn one in to me. The
exams will be inside my mailbox in the lounge on the first floor of
Amos Eaton. Also, sometime tomorrow afternoon I will put the
remaining midterm exams in my mailbox for those who did not pick
them up previously. I'll leave the exams there for one week.
Anything not claimed by Friday, 12/14 will be trashed.
Homework 4 has not yet been completed. My goal is the end of the
- December 5th
Solutions (PDF) to today's final exam. Note
that there is,
of course, More Than One Way To Do ItTM for virtually
- The final exam grades will be recorded as they are corrected.
You may check your grades online regularly to see if yours has been
graded yet. Likewise for HW4. An anouncement will be posted when
all exams and homeworks have been corrected.
- December 3rd
If you haven't submitted questions for the final yet, by all means,
do so. I will continue accepting submissions up until I go to make
the 83 copies of the final exam to handout on Wednesday.
Justin informs me that homework 3 has now been corrected and
returned to everyone who submitted. If you did not receive a grade
for HW3, email Justin immediately.
- December 1st
Thus far, I've received very few questions for the final exam.
Please make sure you get your questions in by Sunday night at the latest, to
have full opportunity to earn bonus points. Remember, any question I use
on the final is guaranteed 2 points, and any 'good' question can receive
a maximum of 5 points (it is possible to receive bonus points without a
question actually being selected for the final).
- November 28th
Questions (PDF) and Answers (PDF) from today's review
As was pointed out in class today, the path for sendmail on the cgi2
server is different than on the cgi server. If you're using
cgi2.cs.rpi.edu, you need to use the
Yet another way of eliminating those nasty ^M characters from your
file is to use the built-in dos2unix program. It's on both RCS and
- November 27th
A few people seem to have not used an SSH client before. If you
have recently downloaded TeraTerm SSH to use the CS machines, you
may need to modify the settings to get emacs working. Since it was
so long ago since I made the necessary modifications, I'm simply
configuration file for you to download. Put this file in the
directory where TeraTerm is installed, then open a connection to the
CS machines. Emacs should now work fine.
A couple emacs commands you may wish to know immediately: CTRL-x
CTRL-s is "save". CTRL-x CTRL-c is "exit". Others you may find by
searching the web for "emacs key commands" or "emacs shortcuts"
UPDATE: Another way to get rid of the return characters is
to upload the file to the CS machine, and then use Unix's built-in
tr -d \\r <rcsid.cgi> tmpfile
mv tmpfile rcsid.cgi
A few people are having problems getting any of their files working
on the CGI server. Some of these problems have turned out to be the
fault of saving the file in Windows and then transferring it to the
CS machines. Windows places an extra character at the end of each
line, that Unix reads as a ^M. This causes massive problems with
the Perl interpreter. The simple answer is "Don't use Windows.".
If you insist on using windows, you have a couple options. 1) Find
and download the program Textpad, and use the Save as Unix File
option. 2) After transferring your file to the CS machines, open it
in emacs. If you don't see ^M characters at the end of each line,
type ESX x, followed by the command find-file-literally, then enter
your file name. You should now see those nasty characters. Get rid
of each of them.
In my opinion, the "don't use windows" option is easier.
- November 26th
As grades for HW3 are going out, keep in mind that all questions and
comments concerning your grade should be directed to Justin, despite the fact that
email containing your grade will claim to be from me (which is a
result of how the CGI program to automate grade reporting was
- November 24th
A few people appear to be having issues with their CS accounts. A
step-by-step set of instructions on how to get your files on the web
can now be found on the HW4 FAQ page.
Because some people are having these problems, I strongly suggest
you at least get started putting files online, if only a simple
Hello World CGI script, as soon as possible, to be sure you know
what you're doing come Sunday at 8pm when you actually start the
- November 20th
The final exam on 12/5 will be open-book, open-note. You may use
the Camel, the Llama, another Perl text, the class notes, and/or
your own notes. You may not use calculators, PDAs, laptops, or
Following the example of the great Dr. Robert Ingalls, I've decided
to let you, my fine students, help create the final exam. You can
receive a maximum of 5 bonus points on the final exam by submitting
to me a question that would be appropriate for the final. Here's
how this works:
Think of appropriate questions for the final exam. Keep in mind all
the topics we've covered in the 2nd half of the course - Regular
Expressions, Functions, Classes, CGI Programming - as well as the
fact that the final is open-book, open-note. Email to me one or
more questions to ask, along with the answer(s). If I decide to use
your question on the final, you will receive a minimum guarantee of
2 bonus points. "Good" questions can receive a maximum of 5 bonus
points. You may submit as many questions as you wish (but please,
only one email from each person), but only 'the best' question from
each submission will receive bonus points (however, I may decide to
use more than one of your questions on the final - which would give you a
distinct advantage coming into it).
No, homework 3 has not yet finished being graded. Justin is working
on it. We'll let you know when it's done...
Don't forget that our next class on 11/28 will be a review session.
Come prepared with questions to ask. Also, please be absolutely
certain to bring at least one #2 pencil, as I will be handing out
- November 19th
Many people have been asking me how to get anything on the web from
their CS accounts. First, use an SSH client to log into
solaris.remote.cs.rpi.edu. Then, if it doesn't exist, create a
directory named "public.html". Yes, that's "dot", not
"underscore". Then make this directory world-readable. You can do
this by issuing the command
chmod o+r public.html from
your home directory. Then, any time you create a file inside this
directory, you must make this file world-readable too. Use the same
process as above.
- November 14th
After debugging for about two hours, I found the error in the cookie
example. I forgot the two commas in the textfield() function in the
do_form() subroutine. Hooray for Perl....
Here are the various CGI scripts from today's class:
Homework 4 FAQ is now available. Check it
- November 13th
Homework 4 is now available. Due Sunday,
December 2nd, 11:59:59pm EST
- November 10th
Here are the CGI scripts we looked at in class Wednesday:
- November 8th
I've now posted my solution to HW3. As
always, realize that since this is Perl, your code may (in fact,
probably will) look vastly different.
Justin will soon begin grading your homework 3 submissions. Please
direct any concerns about your grade to his CS email address:
- November 7th
UPDATE:To access your CS account, ssh to
solaris.remote.cs.rpi.edu. To transfer files to/from your account,
use the proticol known as scp. Free versions can be found at
Windows users may wish to look at
http://winscp.vse.cz/eng/download.php. I strongly suggest you
download the stable version 1.0, not the 2.0 beta version.
Just as with ssh, you must
connect to solaris.remote.cs.rpi.edu with the scp program.
Slide 20 from today's lecture contained an error that I corrected in
class. The updated slides (and PDF file) are linked in the syllabus
The time has (finally) come for everyone to begin using their CS
accounts. Without them, you will be unable to do any CGI
programming. If you do not yet have a CS account, it is vital that
you contact me immediately so that I may request one for you. If
you have forgotten you CS Account password, email
firstname.lastname@example.org as quickly as possible.
- November 6th
I will be in my office most of today, starting at 9:30am. If you
have questions/problems with HW3, *please* do not wait until 4:00 to
come get them answered.
- November 5th
In preperation for Wednesday's class on CGI programming, I've posted
the introduction to HTML slides. See the course syllabus below.
- November 2nd
For those of you wondering how much time you might spend on this
assignment, I'll give you my statistics. I coded the entire program
this morning, spending about 3 hours from start to finish. My code
is 318 lines long, including comments and whitespace. Determine how
much you think you know Perl better than I do, and allocate the
appropriate amount of time to code it...
- November 1st
Here is a working Homework 2
submission, supplied by D.F. Note that this code contains only
one example of how to create all the functionality of the assignment. Your
project may be vastly different (not to mention vastly shorter or
- October 31st
As announced in class today, I am allowing you to work in groups of
2 on homework 3. If you choose to do this,
submit one homework per
pair, with both names in the email and as the name of the file.
- Due to internet connectivity issues in class today, I was unable
to show you the sample Student class file
and main file that uses the class. Here they
- October 30th
A sample inventory is now available for
- I have finished correcting and returning homework 2. Please check
your grades online to confirm I've recorded what I sent to you. If
you have not received your grade, but believe you submitted a
homework, contact me immediately.
- October 27th
- October 24th
Due to unforseen circumstances, class is cancelled today. However,
I have posted Homework 3, as well as a short
mini-presentation covering some aspects of
Perl that don't fit well anywhere else. I urge you to look at both
This 2-credit course will run the entire semester, from 4:00pm to
5:50pm on Wednesdays.
There will be aproximately five (5) homeworks assignments
throughout the course of the semester. Submission instructions
will be included with each assignment. All homeworks will be due at
11:59:59pm Eastern Time on the due date. Homework will be accepted up
to 24 hours past the deadline at a penalty of 20% off the homework's
grade. Homeworks turned in more than 24 hours past the deadline will
be graded a 0.
There will be two (2) exams: a mid-term exam halfway through the course,
and a final exam on the last day of class. You will have the full 1
hour, 50 minutes to work on each exam. While the final exam will not
be cumulative, the nature of programming will require you to apply
knowledge gained during the first half of the course on the final
Your course grade will be derived by taking either
70% of the Homework average and 30% of the Exam average
60% of the Homework average and 40% of the Exam average,
whichever results in a higher course average for each student.
Your letter grade will be computed based on the following scale:
Do NOT expect a curve or scale. If there are extreme circumstances
(ex, everyone in the class is getting an F), I may consider scaling
the final grades, but don't plan for it.
All homeworks are to be done individually. You may discuss
programming style and concepts with your classmates, but you may
not work together on an assignment. Do not look at anyone else's
code, and do not show your code to anyone else.
When taking the exams, you may use only the resources specifically
noted as acceptable. These may or may not include lecture notes, your
own notes, the course textbook, or other books. Under no
circumstances will these include any other students. Acceptable
resources will be noted at least two (2) weeks prior to each exam.
- "The definitions and examples presented (in the
Rensselaer Handbook) are samples of the various types of academic
dishonesty and are not to be construed as an exhaustive or
exclusive list. The academic dishonesty policy also applies to
scholarly pursuits and research. Additionally, attempts to commit
academic dishonesty or to assist in the commission or attempt of
such an act, are also violations of this policy. If found in
violation of academic dishonestly policies, students may be
subject to two types of penalties. The Instructor administers an
academic penalty (i.e., failure of the course), and the student
may also be subject to the procedures and penalties of the student
judicial system outlined in this handbook." -- The
Rensselaer Handbook of Student Rights and Responsibilities
- You cheat, you fail -- Paul
NOTE: This schedule is Tentative. The topics we cover each
week will depend almost entirely on how much we were able to
cover in the previous lecture.
||HTML Basics (PDF) *
||The very basics - html, head, title, body, font, lists,
||Unix Basics (PDF) *
||The very basics - cd, mkdir, ls, rm, rmdir, chmod,
||Introduction to CSCI-2962 (PDF)
||Policies, Info, etc
||Introduction to Perl (PDF)
||shebang, basic I/O, variables
||Chapter 1, pgs 45-60
||Interpolation (PDF), Context (PDF),
Operators (PDF), File/Directory access (PDF)
||scalar/list context, variable & backslash
interpolation, operator, operator precedence, File &
||pgs 61-79, Chapter 3
||Useful Functions (PDF), Command
line arguments (PDF), Control Structures (PDF)
||@ARGV, push, pop, splice, shift, unshift, keys, values,
if-else, while, do, for, foreach, next, last, redo, until,
||Regular Expressions (PDF)
||intro to regexps, basics of regexps
||More Regular Expressions (PDF)
||modifiers, translation, etc
||Lookaround Assertions (PDF),
Review for Midterm
Question and Answer Session
||defining & calling, parameters, prototypes, return values
||Random bits of
||eval, map, back-ticks, generic quotes, grep, do
||(search the index - all over the place)
||Object oriented programming (PDF)
||references, classes, methods
||Chapter 12 - not all of it
||CGI Programming (PDF)
|CGI Basics - forms, methods, etc
||Llama Chapter 19,
Actual CGI.pm file
||Whatever else we have time for
||Review for Final Exam
||Question and Answer Session
* These topics will not be covered during lecture.
It is assumed most of you are already familiar with these topics. I
am presenting very basic overviews for those who do not, as these
topics will be necessary to carry out certain functions in this
The Perl Quotes Page
A great many things have been said about Perl. Many quite funny.
Some you will find in your textbooks by the authors, others you may
find randomly on the net or in a magazine. If you see something you
think might bring a smile to someone's face, by all means, share it
with the class: