Class 23 review (07/12/2002)
*** STUDY THIS CODE IN CONJUNCTION WITH YESTERDAY's examples.
*** See how they used the =~ m/:/ and the =~ tr/:// in the
http://www.cns.uni.edu/~jacobson/cgi-bin/showColorsv2.cgi
$string = "Mark Jacobson#11#UNI#Panthers#Caps";
$countOfPoundSigns = $string =~ tr/#//; # returns 4 as the count...
print "\nThe count for # symbol was: " . $countOfPoundSigns .
" in the data----> $string <---- \n\n";
print "\nPlease enter a string of data, with or without a UNI in it.\n";
$st = <>;
if ($st =~ m/UNI/)
{
$message = "Your string did contain UNI at least once";
}
else
{
$message = "Your string did NOT contain any occurrence of UNI.";
}
print "\n $message \n";
Yesterday's Thursday - Class #22 review.
NOTE: See class22.html and the URL:
http://www.cns.uni.edu/~jacobson/cgi-bin/colorsv2.cgi
Below here is the View menu, Source for colorsv2.cgi
after clicking the Random Color button at least 6 times.
--------------------------------------------------------
[?xml version="1.0" encoding="utf-8"?]
[!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"
"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd"]
[html xmlns="http://www.w3.org/1999/xhtml" lang="en-US"]
[head]
[title]BGColor Pink, Text Color Black[/title]
[/head]
[body text="Black" bgcolor="Pink"]
[h1]This has background color Pink and text color Black[/h1]
[form method="post" action="/~jacobson/cgi-bin/colorsv2.cgi"
enctype="application/x-www-form-urlencoded"]
[INPUT TYPE='hidden' NAME='recentcolors' VALUE=7:5:2:6:3:0]
[input type="submit" name="Random Color" value="Random Color" /]
[/form]
[P]
[HR]
[H2]Previous 5 (BGCOLOR,TEXT) color pairs:
[OL]
[LI] (Yellow,Purple) [P]
[LI] (Blue,Yellow) [P]
[LI] (White,Black) [P]
[LI] (Black,White) [P]
[LI] (Red,Blue) [P]
[/OL]
[/H2]
[/body]
[/html] NOTE: Had to use BRACKETS { and } instead of < and > symbols...