Hi all, I've made a little script that takes the lines from a file, removes the dupplicate lines and prints the result to a new file. I've read the original file line by line because it is a big file (over 7 MB). The problem is that after printing almost 10% from the original file into the new file, the script dies and the only error I get in the log file is:
[Mon Jul 15 14:44:48 2002] [error] [client 127.0.0.1] Premature end of script headers: clean.pl I've checked the original file to see if there are some strange characters in that line, or in the next one, but I haven't found something that might cause that problem. Please tell me why is the script dying only after it runs for a few minutes, and after writing over 11000 lines, and not from the beginning, if there is a problem with the script. Can you find any problems with my scriptt? Thank you very very much! Here is the script: #!/perl/bin/perl -w print "Content-type: text/html\n\n"; #The original file: my $file = "f:/teddy/data/er.txt"; #The result: my $out = "f:/teddy/data/er_new_good.txt"; #Create the result file (empty): open (OUT, ">$out"); print OUT ""; close OUT; #Open the original file: open (FILE, $file); line: while (<FILE>) { my $line = $_; #Open the result file: open (OUT, "$out"); while (<OUT>) { #Checks if the line from the original file exists in the result file: if ($line eq $_) { #If the line exists, jump back and read the next line from the original file: next line; } else { #Read the next line from the result file: next; } #End while for the result file: } close OUT; #Open the result file and append the line that was not found: open (OUT, ">>$out"); print OUT $line; close OUT; #Close the while loop for the original file: } Teddy Center: http://teddy.fcc.ro/ Mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]