#### Program: # The Regular Shrink Program print "shrink: Hello.\n"; for (;;) { print " mark: "; $gibberish = ; chomp($gibberish); if ( $gibberish =~ /Good.*bye|^Bye/ ) { last; } print "\ndoctor: Did you say: \"$gibberish\"\n"; } print "\ndoctor: Goodbye, sucker."; __END__ #### Output: doctor: Hello. mark: Hi. How are you? doctor: Did you say: "Hi. How are you?"? mark: Yes. doctor: Did you say: "Yes"? mark: You are crazy! Good bye! doctor: Goodbye, sucker. #### Notes on Code Fragments: $gibberish =~ /.../ # is true if the variable $gibberish matches # the pattern ... /...|.../ # the | means or # the pattern is matched if either ... is matched . # any character (well. almost any character) .* # zero or more of . ^ # matches the start of the string ############################# that's all folks #################################