Hi Paul

On Fri, Apr 1, 2011 at 7:21 PM, Paul Joyce <pjoyce / whatsthis.ie> wrote:
> Adding opf =3D 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. =A0I mean the problem arises in th=
e
> line following the File.new statement that defines opf ???

As my code shows, the variables defined in a loop reset with nil on each lo=
op.
This is a feature of "local-variable(in-block)".

When a variable is defined outside the loop, it is "local-variable"
(not in-block).
This local-variable is not reseted and works as you expect.

To check the type of  a variable 'v', try "p defined?(v)".

--=20
Haruka YAGNI