1 ffd9a51f 2023-08-04 jrmu #!/usr/bin/perl
3 ffd9a51f 2023-08-04 jrmu # Modify the previous program to allow Fred to match as well. Does it match
4 ffd9a51f 2023-08-04 jrmu # now if your input string is Fred, frederick, or Alfred? (Add lines with
5 ffd9a51f 2023-08-04 jrmu # these names to the text file.)
7 ffd9a51f 2023-08-04 jrmu use warnings;
11 ffd9a51f 2023-08-04 jrmu foreach (grep(/[Ff]red/, <>)) {
15 ffd9a51f 2023-08-04 jrmu #my @words = <>;
16 ffd9a51f 2023-08-04 jrmu #my @matches = grep(/fred/, @words);
17 ffd9a51f 2023-08-04 jrmu #foreach (@matches) {
18 ffd9a51f 2023-08-04 jrmu # print "$_";