Hold on! It looks to me that your perl program is called "not.txt" and then you are opening the same file for write, which will trucate it to zero bytes! That's like sitting on the branch of a tree and sawing it off next to the trunk.
Call your program something like "not.pl", otherwise you will loose your code.