Hi Haruka

Thank you for you help.  I guess its a good idea to initialise vars.
Adding opf = nil solves the problem, though I must confess to not being
entirely sure why, since the initialisation should create it, and as far
as I can tell it exists for the rest of the runtime, just closes and
re-opens pointing to a different file.  I mean the problem arises in the
line following the File.new statement that defines opf ???

Anyway - it now works - thats the main thing!

thanks again
much appreciated
Paul

-- 
Posted via http://www.ruby-forum.com/.