On Tuesday 08 January 2002 11:46, you wrote:
> On Tue, 2002-01-08 at 02:19, mike wrote:
> > #!/usr/bin/perl -w
> > open(FILES,">lista");
> > open (FILES2,"<lista");
>
> It might not make any difference, but did you try closing FILES before
> opening FILES2? Sometimes odd things happen when two things try to use
> the same file at once, and I can't see any need to keep that file handle
> open.Isn't it good practice to close filehandles when you've finished
> with them?
I think it's a good suggestion, and it's not just good practice, because
FILES is not getting flushed, before it's re-opened as FILES2.
Even better would be to open it once, for reading and writing, and write
first, and then through the same file descriptor read it back. This method
allows you to delete the written file immediately after opening it.
I forget how easy that is to do in perl(1), you might have to go to lower
level file I/O or one of the modules to do it.
Rob
--------------------------------------------------------------------
http://www.lug.org.uk http://www.linuxportal.co.uk
http://www.linuxjob.co.uk http://www.linuxshop.co.uk
--------------------------------------------------------------------
This archive was generated by hypermail 2.1.3 : Tue 08 Jan 2002 - 12:24:31 GMT