Blob


1 #!/usr/bin/perl
3 # Modify the program from the previous exercise so that the word ending with
4 # the letter 'a' is captured into $1. Update the code to display that
5 # variable's contents in single quotes, something like $1 contains 'Wilma'.
7 use warnings;
8 use strict;
9 use utf8;
11 while (<>) {
12 chomp();
13 if (/\b(\w*a)\b/) {
14 print "Matched: $`<$&>$': \$1 contains '$1'\n";
15 } else {
16 print "No match: |$_|\n";
17 }
18 }