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