#!/usr/bin/perl -w my $file = shift; my $start = shift; my $end = shift; my $outfile = "$file.out"; open(IN, "<$file") || die "Can't open $file!\n"; open(OUT, ">$outfile") || die "Can't open $outfile!\n"; while() { if (/$start(.*)$end/) { print OUT $1; } }