Thanks very much for all the replies, and especially for the examples as that's usually the missing key in any explanation (such as using the pos function in perldocs). I'll work my way through them and see what works best. Many thanks Iain