Thanks it worked. I'm not sure what line it was that was causing me the problem but I copied this and made the slight adjustments I needed and it worked. Does the while (<$filehandle>) { ... } work just as well or should I be using this form all the time? Thanks.
Rob