1. What two operations change an array from the front or first element? 2. What two operations change an array from the last element? 3. Write the two Perl statements that would take array @a and make the 1st element into the last element. (Using #1 and #2 operations). [0] [1] [2] ----------------- For example, if @a is | 100 | 200 | 300 | before the two statements, ----------------- [0] [1] [2] ----------------- it will be | 200 | 300 | 100 | afterwards. ----------------- 4. Write the two Perl statements that would take array @a and make the last element into the first element. Using #1 and #2 operations). 5. Write the one Perl statement that would create array @numbers from the scalar variable $numberList. $numberList = "111;222;333;444"; # Assume ; separates each pair... 6. In the statement that follows, what term is used to describe the word 'Ghostbusters'? print "Ghostbusters came out in " . $yearOfMovie{'Ghostbusters'}; 7. Write the statement that would create the string of colon separated values from the values in array @a. Name the variable to hold the colon separated values string $myValues. [0] [1] [2] ------------------- @a | 111 | 222 | 333 | would make $myValues string "111:222:333" ------------------- ----------- 8. Write the single Perl statement that will cause the change in variable $data contents, as illustrated below. Basically the vowels aeiou have been converted to uppercase AEIOU. $data = "abcdefghijklmnopqrstuvwxyz"; MYSTERY PERL STATEMENT GOES HERE. print $data; OUTPUT IS: AbcdEfghIjklmnOpqrstUvwxyz 9. What does the E in PERL stand for? 10. 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 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.? 11. What is the term that describes something the following Perl programmer apparently did not know about or is not taking advantage of? print "Volume is " . $volume . " for cylinder with height " . $height . " and radius " . $radius; 12. Write the Perl statement that would execute the Unix cal command and store the results in the variable $thisMonthsCalendar. Clearly indicate the syntax of your statement for any special symbols by shaping them so they are not confused with the wrong symbol from the keyboard. 13. Here is a screen snapshot of the web page displayed by the showForm.cgi Perl script. Write the showForm.cgi script. Name the text box with the name numValue (for your FORM). Computes the cube of a number <---- BIG, BOLD LETTERS (heading style) ----------- n: | | ----------- ******************** * Show cube of n * <----- This is the SUBMIT ******************** button and it invokes showCube.cgi Perl script, that you write for question number 14. 14. Write the showCube.cgi Perl script. Remember, the names of the text box on the FORM is: numValue. Your output could look like this, for a specific example: The cube of 5 is 125. <------- THIS IS ALL THE OUTPUT YOU NEED... MAKE IT QUICK AND DIRTY so that showCube.cgi is a SMALL perl script. The cube of 7 is 343 <------- A second example The cube of 10 is 1000 <******* 3rd example is the charm... 15. A hash uses the symbol % to indicate that the Perl variable is a hash? Explain why the % symbol is perfect syntactic expression for what a hash is? Be very explicit and get into exactly what the % symbol looks like. The % character has 3 parts, 2 circles and one slash / separating the two little circles. 16. How many lines of output will the following program produce, if the user typed in UNI at the ENTER DATA: prompt? Note: Do not count the ENTER DATA: prompt as a line of output. All other lines, including blank lines, count as output. #------------------------------------------------------------------ print "ENTER DATA: "; $data = ; # User typed in UNI. (SEE NOTE ABOVE!) while (length $data > 0) { print $data . "\n"; chop $data; } print "\n ----------------- \nThat is all for this program! \n"; #------------------------------------------------------------------