in reply to Re: Recursive file opening: reading an undef at the end of file
in thread Recursive file opening: reading an undef at the end of file

Because a lexical filehandle was used, the file opened by each call to the subroutine will be closed when the that call to the subroutine returns.

There may be a problem if you are expecting hundreds of nested calls, but otherwise there is nothing wrong here. Each file is closed immediately after reaching its end.

  • Comment on Re: Re: Recursive file opening: reading an undef at the end of file