I'll bet this had nothing to do with your syntax and everything to do with what $read was returning.. ie. it wasn't finding anything in the file.
There's a good debugging tutorial at
http://kthx.net/ftb which may cover how to tackle problems like these in the future.