topical media & game development

talk show tell print

basic-regex-26-Alternation.pl / pl



  #!/usr/bin/perl -w
  use strict;
  my myPattern = "(Jim|Fred|Alice)";
  print "Enter your first name here: \n";
  my myTestString = <STDIN>;
  chomp(myTestString);
  if (myTestString =~ m/myPattern/)
  {
   print "Hello &. How are you?";
  }
  else
  {
   print "I am sorry, myTestString. I don't know you.";   
  }


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.