my $x = "now is the time for all good men";
if ($x =~ /for all (good )?men/) { #will match with or without the 
    # good and space.  These characters were made into
    # a capturing group by the  ( ) and the ? instructs that the 
    # capturing group must appear 0 or one times,
    # that is 'good " must appear 0 or 1 times
    print "we matched\n";
}


my $months = 
  "1jan 2feb 3mar 4apr 5may 6jun 7jul 8aug 9sep 10oct 11nov 12dec";
my $thisMonth = "Mar";
if ($months =~ /(\d)$thisMonth/i) { #the i ignores case 
    # and the (\d) will match digits
    print "we found the month, it is number $1\n";
    #NOTE: where a capturing group matches the matched text 
    #   is placed in $1
}
else {
    print "unknown month\n";
}
