Blob


1 #!/usr/bin/perl
3 # Using the pattern test program, make a pattern that matches if any word (in
4 # the \w sense of word) ends with the letter 'a'. Does it match 'wilma' but
5 # not 'barney'? Does it match 'Mrs. Wilma Flintstone'? What about
6 # 'wilma&fred'? Try it on the sample text file from the Exercises in Chapter
7 # 7 (and add these test strings if they weren't already in there).
9 use warnings;
10 use strict;
11 use utf8;
13 while (<>) {
14 chomp();
15 if (/a\b/) {
16 print "Matched: |$`<$&>$'|\n";
17 } else {
18 print "No match: |$_|\n";
19 }
20 }