Blob
1 #!/usr/bin/perl3 # Make a program that prints each line of its input that mentions fred. (It4 # shouldn't do anything for other lines of input.) Does it match if your5 # input string is Fred, frederick, or Alfred? Make a small text file with a6 # few lines mentioning "fred flintstone" and his friends, then use that file7 # as input to this program and the ones later in this section.9 use warnings;10 use strict;11 use utf8;13 foreach (grep(/fred/, <>)) {14 print "$_";15 }17 #my @words = <>;18 #my @matches = grep(/fred/, @words);19 #foreach (@matches) {20 # print "$_";21 #}