open (my $file1,"<$dir/seq.results") or die "cannot open "$dir/seq.results"; open (my $file2,">$dir/seq.out") or die "cannot open $dir/seq.out" for write"; my $started =0; while (<$file1>) { $started =1 if (m/^\*/); #first line starting with * is seen print $file2 "$_" if $started; }