#!/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); #### #!/usr/bin/perl $infile = "my_file"; open (FILE, $infile); @text = ; close(FILE); foreach $line (@text) { $_ = $line; if (/^Info I want/../^Start of Info/) { print; } }