{\rtf1\ansi\ansicpg1252\uc1 \deff0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Thorndale};}{\f2\fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New;}
{\f29\fswiss\fcharset128\fprq2{\*\panose 020b0604020202020204}Arial Unicode MS;}{\f30\fswiss\fcharset128\fprq2 @Arial Unicode MS;}{\f31\froman\fcharset238\fprq2 Times New Roman CE{\*\falt Thorndale};}
{\f32\froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Thorndale};}{\f34\froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Thorndale};}{\f35\froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Thorndale};}
{\f36\froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Thorndale};}{\f37\froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Thorndale};}{\f38\froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Thorndale};}
{\f47\fmodern\fcharset238\fprq1 Courier New CE;}{\f48\fmodern\fcharset204\fprq1 Courier New Cyr;}{\f50\fmodern\fcharset161\fprq1 Courier New Greek;}{\f51\fmodern\fcharset162\fprq1 Courier New Tur;}{\f52\fmodern\fcharset177\fprq1 Courier New (Hebrew);}
{\f53\fmodern\fcharset178\fprq1 Courier New (Arabic);}{\f54\fmodern\fcharset186\fprq1 Courier New Baltic;}{\f265\fswiss\fcharset0\fprq2 Arial Unicode MS Western;}{\f263\fswiss\fcharset238\fprq2 Arial Unicode MS CE;}
{\f264\fswiss\fcharset204\fprq2 Arial Unicode MS Cyr;}{\f266\fswiss\fcharset161\fprq2 Arial Unicode MS Greek;}{\f267\fswiss\fcharset162\fprq2 Arial Unicode MS Tur;}{\f268\fswiss\fcharset177\fprq2 Arial Unicode MS (Hebrew);}
{\f269\fswiss\fcharset178\fprq2 Arial Unicode MS (Arabic);}{\f270\fswiss\fcharset186\fprq2 Arial Unicode MS Baltic;}{\f273\fswiss\fcharset0\fprq2 @Arial Unicode MS Western;}{\f271\fswiss\fcharset238\fprq2 @Arial Unicode MS CE;}
{\f272\fswiss\fcharset204\fprq2 @Arial Unicode MS Cyr;}{\f274\fswiss\fcharset161\fprq2 @Arial Unicode MS Greek;}{\f275\fswiss\fcharset162\fprq2 @Arial Unicode MS Tur;}{\f276\fswiss\fcharset177\fprq2 @Arial Unicode MS (Hebrew);}
{\f277\fswiss\fcharset178\fprq2 @Arial Unicode MS (Arabic);}{\f278\fswiss\fcharset186\fprq2 @Arial Unicode MS Baltic;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;
\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}
{\stylesheet{\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0 Normal;}{\*\cs10 \additive Default Paragraph Font;}{
\s15\ql \li0\ri0\nowidctlpar\aspalpha\faauto\rin0\lin0\itap0 \fs24\cf1\lang1033\langfe255\cgrid\langnp1033\langfenp255 \snext15 Default;}{\s16\ql \li0\ri0\nowidctlpar\tqc\tx4320\tqr\tx8640\aspalpha\faauto\rin0\lin0\itap0 
\fs24\cf1\lang1033\langfe255\cgrid\langnp1033\langfenp255 \sbasedon15 \snext16 header;}{\*\cs17 \additive \fs24\cf1\lang0\langfe255\langfenp255 Numbering Symbols;}}{\info{\author Sharon Tuttle}{\operator CNRS}{\creatim\yr2004\mo8\dy2\hr14\min32}
{\revtim\yr2004\mo9\dy3\hr12\min34}{\printim\yr2004\mo9\dy2\hr9\min12}{\version2}{\edmins1}{\nofpages2}{\nofwords834}{\nofchars4756}{\*\company CNRS-HSU}{\nofcharsws5840}{\vern8269}}\margt2093 
\deftab1250\widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\hyphcaps0\horzdoc\dghspace120\dgvspace120\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind4\viewscale124\viewzk2\nolnhtadjtbl \fet0\sectd 
\sbknone\linex0\headery1440\sectdefaultcl {\header \pard\plain \s16\ql \li0\ri0\nowidctlpar\tqc\tx4320\tqr\tx8640\aspalpha\faauto\rin0\lin0\itap0 \fs24\cf1\lang1033\langfe255\cgrid\langnp1033\langfenp255 {\fs16 
CIS 480 -  Homework #2 and Week 2 Lab Exercise \tab \tab p. }{\field{\*\fldinst {\fs16 \\page}}{\fldrslt {\fs16\lang1024\langfe1024\noproof 2}}}{
\par }{\fs16 Fall 2004
\par }}{\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}
{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl8
\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}\pard\plain \s15\qc \li0\ri0\nowidctlpar\aspalpha\faauto\rin0\lin0\itap0 
\fs24\cf1\lang1033\langfe255\cgrid\langnp1033\langfenp255 {\b\fs20 CIS 480 - Perl in Depth - Fall 2004 - }{\b REVISED 9-3-04}{\b\fs20 
\par WEEK 2 LAB EXERCISE and Homework #2
\par 
\par week 2 lab exercise due: Thursday,  September 2nd , END of lab
\par }\pard \s15\qc \fi-420\li420\ri0\nowidctlpar\aspalpha\faauto\rin0\lin420\itap0 {\b\fs20 HW #2 due: Thursday, September 9th, 12:00 noon
\par }\pard \s15\ql \li0\ri0\nowidctlpar\aspalpha\faauto\rin0\lin0\itap0 {\b\fs20 
\par }{\fs20 For }{\b\fs20 EACH}{\fs20  of the scripts below (lab exercise AND homework), you are required to begin EACH with the following:
\par }{\b\fs20 
\par }{\b\fs20\loch\af2 \hich\af0\dbch\af0\loch\f2 #!/usr/bin/perl -w
\par \hich\af0\dbch\af0\loch\f2 ###480-author: }{\i\fs20\loch\af2 \hich\af0\dbch\af0\loch\f2 yourLastName}{\b\fs20\loch\af2 
\par \hich\af0\dbch\af0\loch\f2 ###480-scriptname:}{\fs20\loch\af2 \hich\af0\dbch\af0\loch\f2  }{\i\fs20\loch\af2 \hich\af0\dbch\af0\loch\f2 yourScriptName}{\b\fs20\loch\af2 
\par }{\b\i\fs20\loch\af2 
\par }{\fs20 Note that the spacing and header need to be exact --- I hope to develop a Perl script to process these in some interesting and useful fashion. More on that as it develops.
\par }\pard \s15\ql \fi-420\li420\ri0\nowidctlpar\aspalpha\faauto\rin0\lin420\itap0 {\b\fs20\ul 
\par WEEK 2 LAB EXERCISE
\par 
\par }{\b\fs20 1.\tab }{\fs20 Write a script }{\b\fs20 sum_range}{\fs20  that asks the user for the first value in a range
, and for the last value in a range. It then stores these values into an array and then uses that array to compute, and then print, the sum of the values within that range. (Since this is intended to be list/array practice, computing this sum in an altern
ate way that does not use lists/arrays will not be accepted.)}{\b\fs20 
\par 
\par 2.}{\fs20 \tab You need to determine how many of each kind of drink to buy for a crowd. Write a script }{\b\fs20 count_drinks}{\fs20  that asks for the next drink choice, until a drink of }{\b\fs20 q}{\fs20  (for quit) is entered. It must use
 a hash to keep track of how many times each drink is requested, and at the end, to print to the screen each drink and its number of requests, one drink-quantity pair per line.}{\b\fs20 
\par 
\par }\pard \s15\ql \li0\ri0\nowidctlpar\aspalpha\faauto\rin0\lin0\itap0 {\fs20 When you are done, read both scripts into a single e-mail message with the Subject: line }{\b\fs20 480 lab 2 }{\fs20 (}{\b\fs20 NO ATTACHMENTS}{\fs20 ), and e-mail them to }{
\b\fs20 st10@humboldt.edu}{\fs20  by the }{\b\fs20 end}{\fs20  of }{\b\fs20 today's}{\fs20  lab.}{\b\fs20 
\par }\pard \s15\ql \fi-420\li420\ri0\nowidctlpar\aspalpha\faauto\rin0\lin420\itap0 {\b\fs20\ul 
\par HOMEWORK #2
\par 
\par }{\b\fs20 1.\tab }{\fs20 write a}{\b\fs20  play_shop }{\fs20 script. The user is asked to enter foods for a shopping list. Then the user is asked for numeric positions (until they
 enter a negative numeric position), and after entering each position  the user is shown the food item that's in that position on the list (by printing its name to the screen). (Use position 0 for the first item, position 1 for the second, etc.)  When use
r enters a negative numeric position, then print the entire list to the screen, one food per line.
\par }{\b\fs20 
\par 2.\tab }{\fs20 Write a script}{\b\fs20  stringplay }{\fs20 that reads in a list of strings of separate lines entered by the user until
 end-of-input and prints out the list THREE times, one string per line: once in its ORIGINAL order, once in REVERSE order, and once in SORTED order (When the input comes from the keyboard, you'll probably need to signal end-of-input by pressing control-d 
(on cs-server)...). Then, in a single-line print statement, state how many lines were read in.}{\b\fs20 
\par 
\par 3.\tab }{\fs20 Write a script }{\b\fs20 arrayplay}{\fs20 . Ask the user how large an array he/she wants. Make the array element at one minus that size the value "THE END". Ask the user for a 
range, then set the array elements at those indices to "RANGE". Then print your final array's contents, one value per line, but print the string "undef" if the value of that element is indeed the special value undef}{\b\fs20 
\par 
\par 4.\tab }{\fs20 You may know that the median of a se
t of values is the value such that half of the values in the set are higher than that value, and half the values in the set are lower than that value. (There are more precise definitions, but this should do.) If there is an odd number of values, the media
n is the middle value; if there is an even number of values, the median is the average of the two middle values.
\par 
\par \tab Write a script }{\b\fs20 get_median}{\fs20 ; it asks for a list of values from the user, and then computes and print the median of those values to the screen in a descriptive message.}{\b\fs20 
 [NOTE added 9-3-04: note that you will be computing the ALPHAMERIC median... and since the average of two alphameric values is an odd concept, this script should print BOTH "middle" values when there is an even number of items, and 
the SINGLE "middle" value when there is an odd number of items. Be sure to ASK ME if this note does not make sense to you.]
\par 
\par 5.\tab }{\fs20 There is a club that wishes to poll its membership to see on which day club meetings should be held (in a rather simplified, straightforward way... 8-) ). Write a script }{\b\fs20 day_vote}{\fs20  which:}{\b\fs20 
\par }\pard \s15\ql \fi-420\li840\ri0\nowidctlpar\aspalpha\faauto\rin0\lin840\itap0 {\fs20 *\tab fills a hash with the days of the week}{\b\fs20  mon, tue, wed, thu, fri, sat, sun, }{\fs20 with the initial value 0 for each.
\par }{\b\fs20 
\par }{\fs20 *\tab it then asks the user to enter each member's day-of-the-week choice for meetings, such that:
\par }\pard \s15\ql \fi-420\li1275\ri0\nowidctlpar\aspalpha\faauto\rin0\lin1275\itap0 {\fs20 *\tab it asks the user to enter the next member's name, and that member's choice for day of the week;
\par *\tab if the user enters a day of the week NOT in the above list, he/she is asked to enter that choice again;
\par *\tab if a member's name is entered more than once, their previous day choice should have its count decreased by one (since it is about to be overwritten);
\par *\tab once a "good" choice has been entered, that member's name and choice are entered into a member_choices hash, and the count for that day of the week is increased by one;
\par }{\b\fs20 
\par THIS FOLLOWING REQUIREMENT WAS RE-WRITTEN 9-3-04:
\par }\pard \s15\ql \fi-420\li840\ri0\nowidctlpar\aspalpha\faauto\rin0\lin840\itap0 {\fs20 *\tab 
then, it prints out the count of votes for each day of the week, in no particular order, one day-vote pair per line, and it follows that day-vote listing with the names of the mem
bers, one per line, who chose the day(s) receiving the highest number of votes. (Remember that }{\b\fs20 sort}{\fs20 \~
will not help for determining the most popular day --- however, you should be able to use a loop to do so, especially if you remember that Perl treats varia
bles based on their context, so if you compare the hash's day counts using numeric comparators, you will get numeric comparisons.)}{
\par }{\b\fs20 \tab AGAIN, be sure to ASK ME if you do not understand this revised requirement.
\par }\pard \s15\ql \fi-420\li420\ri0\nowidctlpar\aspalpha\faauto\rin0\lin420\itap0 {\b\fs20 
\par }\pard \s15\ql \li0\ri0\nowidctlpar\aspalpha\faauto\rin0\lin0\itap0 {\fs20 When you are done, read all of these scripts  i
nto a single e-mail message with the Subject: line 480 hw 2 (NO ATTACHMENTS), and e-mail them to st10@humboldt.edu by the due date and time given above.
\par 
\par (remember, you can use ^R within your properly-configured pine on cs-server to copy a file's contents reliably into an e-mail message.)
\par }\pard \s15\ql \fi-420\li420\ri0\nowidctlpar\aspalpha\faauto\rin0\lin420\itap0 {\b\fs20 
\par 
\par }}