Section for Week 6, Thursday, 2/18/99 Notes: a) A set of checkboxes can have different names, or else one can have same names for an entire group, and change the VALUE tag everytime to get actual info. b) Fourth HW solutions are up. Topics: 1. {m,n} and variants for patterns Recall that adding {m,n} after a pattern means to repeat that pattern between m and n times. For instance, /\d{3,5}/ will match between 3 and 5 digits (inclusive). Omitting the second parameter removes the upper limit, but the first parameter must be present (can be 0). If only one parameter is present and no comma, then an exact count is matched. So /[\dA-Fa-f]{2}/ will match two hex digits. 2. Recall that s/OLD/NEW/g will substitute ALL occurences of the OLD pattern with the NEW pattern (because of the 'g'lobal modifier). If we add the 'e' modifier ('e' is for 'evaluate'), the string in the NEW pattern space is first evaluated as a perl statement and the result of the expression is used for the NEW pattern. So for example, to convert a character given as %xx (in hex notation), you could do: s/\%([\dA-Fa-f]{2})/chr(hex($1))/ge 3. Name-value pairs Consider the following URL sent to a CGI program from the prof's sample_form.html form (the newlines were added for readability): http://www.math.ucla.edu/~baker/40/get_info.cgi?name=Ami+Fischman& email=fischman%40math.ucla.edu& opinion=Your+product+is+fantabulous%21++%0D%0AIt+has+changed+my+life+in+SOOO+many+ways.& student=on& oldornew=repeat& state=CA& computer=PC+with+Win+NT Features to note: Spaces --> '+' Fields seperated by '&' Most char's other than [A-z.,] are quoted in hex using %XX notation.