- Which perl datatype(s) would you use to store each of the
following? Write a short example in which you create, access, and
modify the data.
- The current temperature.
- Name, ID number, and year of people in the Perl class. Think
about how the way that you're accessing the data may affect the
type of storage used.
- The above information, but as someone types it into your
program (rather than typing it in when you write the
program).
- We said that
my declares a lexically scoped
variable. What does that mean? (Ask the nearest Course VI major
if you don't know).
- Write a short program to accept three numbers as user input
and print the average.
- Extend the above to accept an arbitrary quantity of numbers.
How many ways could you write this? (I can think of at least 5).
- Given an array of numbers, print the list without duplicates
in ascending orders.
- Given an array of numbers, print only the ones which occur
more than once.
- Write a program that prints only the lines of its input which
contain a certain word. (similar to grep).
- Use your favorite spreadsheet program to create a spreadsheet
and save it in some text format (tab or comma separated values).
Now write a program to print out selected fields of rows that meet
some criteria.
- Write a recursive version of a program to compute factorials.
- Write a program that acts as an alarm clock. It should ask
you what time to go home and then prints a message when it's time
to go. Some useful info
- The
date command on unix machine will tell
you the current time and date. There are other ways to do this in
Perl, as well, that you can use if you find them.
- You may wish to use the
sleep procedure, which
causes your script to sleep for some number of seconds. This is a
useful way to insert a timed delay and also doesn't monopolize CPU
time.
|