Sep 14 -- perl ---------------- * go over homework * primes program * review * arrays * hashes * syntax * loops * conditionals * subroutines sub name { my ($var1, $var2) = @_; # This is the highly recommended form return whatever(); } * file i/o give a simple example; discuss "chomp". open INPUT, "filename" or die "Oops couldn't open INPUT ... "; my $line = ; chomp($line); # ... open OUTPUT, ">filename" or die "Oops couldn't open OUTPUT ... "; print OUTPUT $line; # No comma between OUTPUT and $line !! In class : * write a program to print a table of squares * on cs.marlboro.edu, /usr/share/dict/words has one perl line. Write a program to print a random sentence. - How do we make the first letter upper case? (Google: "perl convert word uppercase, perldoc.com manual perlfunc) - How do we pick a random number? (Google: "perl random number" - How many lines are there in the dictionary? - text editor, or - program to count 'em. * Questions ? ------------------------------------------------------------------------ CGI 101 : * running a script.cgi program on cs.marlboro.edu from the command line * executing it via the web from within ~user/html/cgi/ * apache configuration * printing out the headers * printing out the html * users and permissions ------------------------------------------------------------------------ if time allows : * environment variables and ?key1=value1,key2=value2 in the URL