#!/usr/bin/perl use strict; use warnings; @ARGV == 1 or print "Usage: perl $0 testlines.txt\n" and exit; { local $/ = "\n\n"; print grep /\b(?:third|four)\b/i, <>; } #### C:\Old_Data\perlp>perl test3.pl testlines.txt This is line one. Line Two is this. Third line starts here. This is line four.