1、Anchoring Patterns
    \b意味着字符边界。代码:
    print "what's your name?";
    $name=<STDIN>;
    chomp($name);
    if($name=~ /^randl\b/i){
        print "matched\n";
    }else{
        print "not matched\n";
    }
    如果输入randl*,  *是字符、数字和下划线,那么都会打印not matched
   而输入"randl%"、"randl fa"等则matched。


    /fred\b/; # matches fred, but not frederick
    /\bmo/; # matches moe and mole, but not Elmo
    /\bFred\b/; # matches Fred but not Frederick or alFred
    /\b\+\b/; # matches "x+y" but not "++" or " + "
    /abc\bdef/; # never matches (impossible for a boundary there)
   word boundary按字面来看是一种边界,一个位置。在这个位置两边的字符一个与\w匹配,一个与
   \W匹配,这是一种情况;还有一种情况就是,一个字符与\w匹配,而另一个字符嘛,要么是
   字符串的打头,要么是结尾。而\b这个anchor恰恰需要在它出现的位置是一个word boundary。
   再看来/abc\bdef/,\b两边一个是c,一个是d,都与\w匹配,这已不满足上述的第一种情况,
   至于第二种情况,更加不会是字符串的打头或末尾了。所以\b出现的地方不可能是word boundary。


附Learning Perl中的片段说明:

if ($name =~ /^Randal/) {
## yes, it matches
} else {
## no, it doesn't
}
Note that the regular expression is delimited by slashes. Within the slashes, spaces and other whitespace
are significant, just as they are within strings.
This almost does it, but it doesn't handle selecting randal or rejecting Randall. To accept randal,
we add the ignore-case option, a small i appended after the closing slash. To reject Randall, we add a
word boundary special marker (similar to vi and some versions of grep) in the form of "b in the regular
expression. This ensures that the character following the first l in the regular expression is not another
letter. This changes the regular expression to be /^randal"b/i, which means "randal at the
beginning of the string, no letter or digit following, and OK to be in either case."