#!/usr/bin/perl -w use strict; my $string = ''; while(<>){ $string .= $_ if /^START$/ .. /^STOP$/; } print $string; __END__