Re: pattern matching
- Posted by Alyne & Warren <WCBaker at HOME.COM> Dec 29, 1999
- 520 views
Hi David! Here is an example of using the carot see if the comparison begins with a string: . . . $comparison1="Name: Janet"; #contains the string to scan for a match $comparison2="NamQ: Janet"; #contains the string to scan for a match print "<br>"; if ($comparison1 =~/^Nam/) {print "Hey it starts with the string!;"} print "<br>"; if ($comparison2 =~/^Name/){print "Hey, this one too!";} else {print "gosh, this one doesn't";} quit; The above yields: Hey it starts with the string!; gosh, this one doesn't Cheers! --Warren