Blob


1 #!/usr/bin/perl
3 # Make a program that prints each line of its input that contains a period
4 # (.), ignoring other lines of input. Try it on the small text file from the
5 # previous exercise: does it notice Mr. Slate?
7 use warnings;
8 use strict;
9 use utf8;
11 foreach (grep(/\./, <>)) {
12 print "$_";
13 }
15 #my @words = <>;
16 #my @matches = grep(/fred/, @words);
17 #foreach (@matches) {
18 # print "$_";
19 #}