This is the matching script from the class today. It takes a single argument on the command line, which is a file. The script will read the file, line by line, and print only the lines that match the given regular expression.
#!/usr/bin/perl use strict; use warnings; open(INPUT, '<', $ARGV[0]) or die "Could not open file: $!\n"; while (<INPUT>) { print if /cat/; } close INPUT;