#!/usr/bin/perl use strict; my $l; while () { if ($_ =~ /^====/) {chomp $l;} print $l; $l=$_; } print $l; __DATA__ one two ====three four