#!/usr/bin/perl $infile = shift @ARGV; open (FILE, $infile) or die "Unable to open $infile: $!"; while () { foreach (@ARGV) { $pattern = $_; if ($pattern eq "Info I want") { if (/^Info I want/../^Start of/) { print unless ( /^Start of Info/ ); } } } } close (FILE);