Help for this page

Select Code to Download


  1. or download this
    my $magicRegex = munge($word); 
    if (/^h$magicRegex$/) {...}
    
  2. or download this
    my $number = qr#(-?\d+\.?\d*)#;
    my $mixNmatch = qr#(?:(?:\s+[d][a-z]*\s+$number)|(?:\s+[oa][a-z]*\s+$n
    +umber))*#;
    while ($_ = <>)
    ...
      no warnings;  # dealing with undefs is clutter for this example
      print /^lock$mixNmatch\s*$/i ? "Yes: disp=$1, offset=$2\n" : "nope\n
    +";
    }