# read a file and set a flag (boolean) if pattern is found
# we then will print the following line and reset the flag
open(OUT,$outputfilename)||die "Could not open $outputfilename for out+put\n$!\n";
open(FILE,$inputfilename)||die "Could not open $inputfilename for read+ing\n$!\n";
while(<FILE>){
if($checked){
print OUT;
undef $checked;
next;
}
if(/pattern/){
$checked=1;
next;
}
}
close(FILE);
close(OUT);