Blob
1 #!/usr/bin/perl3 # Modify the program from the previous exercise to use named captures instead4 # of relying on $1. Update the code to display that label name, something5 # like 'word' contains 'Wilma'.7 use warnings;8 use strict;9 use utf8;11 while (<>) {12 chomp();13 if (/\b(?<word>\w*a)\b/) {14 print "Matched: $`<$&>$': word contains '$+{word}'\n";15 } else {16 print "No match: |$_|\n";17 }18 }