Name ______________________________________ August 3, 2001 1. What two operations change an array from the back or last element? 2. Write the one Perl statement that would create array @numbers from the hyphen (-) separated values in the scalar variable $numberList. $numberList = "111-222-333-444"; # Assume - separates each pair... 3. Write the statement that would create the string of hyphen separated values from the values in array @uni. Name the variable to hold the hyphen separated values string $uniValues. [0] [1] [2] ------------------- @a | 123 | 456 | 789 | would make $uniValues string "123-456-789" ------------------- ----------- 4. Write the two Perl statements that would take array @a and make the last element into the first element. 5. Write the Perl statements to print the characters of whatever word the user entered in wordForVertical in a column, a vertical column, with the 1st letter on the 1st line, and the 7th letter on the 7th line, and so on. Your Perl statements are to be executed by the web server after the user clicks the submit button. The client web browser will display the results. Write the entire Perl script. 6. Assume that you have called the localtime(time) function and that array @colors has values as follows: @colors = qw(YELLOW GREEN BLUE ORANGE GRAY PINK PURPLE); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$dst) = localtime(time); What one statement would be used to store in the variable $BGColor the appropriate color for the day of the week, where we want Sunday to always be YELLOW, Monday to always be GREEN, etc.? 7. Write the one statement that would be used to open a file for output in your PERL program with the file handle FILEHANDLE. Assume that the file is named seven.txt and that it is stored inside of your web folder. It is NOT inside cgi-bin. The cgi-bin folder is where this script is being executed from, of course. File to be opened: "eleven.txt" is the name. 8. Finish the following program so that it does sends the web page c088.html to client browser. Assume the program is called c088colorSurprise.cgi and that it uses the function rgbValue to calculate and return two RGB triplets. The 1st is for the background color and the 2nd is for the text color. Assume that rgbValues returns an array, just like our guestBook.lib library function rgbValues does. Assume that the file c088.html has on a line all by itself, starting at the beginning of the line, the tag. Your c088colorSurprise.cgi program will send a different line to the web browser, for example: might be sent one time, and the next time, gets sent. Its all taken care of by rgbValue function, which you DO NOT have to define, you just have to use it to get the array of RGB triplets, and then use the array. #!/usr/bin/perl use CGI qw(:standard); require guestBook.lib; # <-- to have access to rgbValue function 9. Here is a screen snapshot of the web page displayed by the showForm.cgi Perl script. Write the showForm.cgi script. Name the 3 text boxes length, width and height. No upper-case letters! Calculates the volume of a box <---- BIG, BOLD LETTERS (heading style) --------------- Length: | | --------------- --------------- Width: | | --------------- --------------- Height: | | --------------- ******************** * Calculate Volume * <----- This is the SUBMIT ******************** button and it invokes calcVolume.cgi Perl script, that you write for question 10. 10. Write the calcVolume.cgi Perl script. Remember, the names of the text boxes are assumed to be length, width and height. ------ ----- ------ Your output could look like this, for a specific example: Box volume is 3000 for box with height 10, length 20 and width 15.