Just a quick comment that's already been suggested...
If you can use a database interface, apart from making diary searches easier, and allowing your diary to grow without a memory overhead, etc, it will allow you not to worry about multiple users. As your code stands, it's fine for a sigle user, but you could have problems if more than one instance of the script runs at the same time. I.e. it could corrupt your text file. If you run a database, it will be much easier to insert\update new diary entries.
I know that using a database is scary at first, but once you try and find it works, you'll wonder how you managed with flat-file databases! There are some great nodes on this site that help with Database access, reply if you'd like me to mention some of my favourites.
Which reminds me - I need to update my home node with links. I'll do that this weekend!
$code or die
Using perl at
The Spiders Web