in reply to deleting a line from a text file

bory, please can you explain in more detail what you are trying to do.

Firstly, the code is iterating keys(%FORM) and doing a sweep of the file for each one. Note, the close brace for this is the second one on the line following print NEW; hence the rename doesn't happen until all keys have been processed (overwriting $file.new each time).

Secondly, your condition check does not depend on the text in the input file!

if ($FORM{$key}==1) { $found =1; next; }
Finally, you should consider using strict and warnings. This will help you by catching many bugs at source. There are many nodes on PM that describe why strict and warnings are a good thing.

Hope this helps,

rinceWind

--
I'm Not Just Another Perl Hacker