if(! -e "/tmp/test.index") { system("/usr/bin/touch /tmp/test.index"); } #This first test is necessary because if I add the creation permission to the open command, it clobbers the file, preventing me from reading from it open(FILE, "+; #printing out the value of $index leads me to believe that this part works if( ! $index =~ /[0-9]+/ ) { $index = 1; } #This should handle any sort of corruption to the file $i++; truncate(FILE, 0); #I do this to be safe. But when I do, it prepends two null characters. print FILE $index; #This command has no apparent effect. close(FILE); exit 0;