1 ffd9a51f 2023-08-04 jrmu #!/usr/bin/perl
3 ffd9a51f 2023-08-04 jrmu # Modify the program from the previous exercise to use named captures instead
4 ffd9a51f 2023-08-04 jrmu # of relying on $1. Update the code to display that label name, something
5 ffd9a51f 2023-08-04 jrmu # like 'word' 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(?<word>\w*a)\b/) {
14 ffd9a51f 2023-08-04 jrmu print "Matched: $`<$&>$': word contains '$+{word}'\n";
16 ffd9a51f 2023-08-04 jrmu print "No match: |$_|\n";