in reply to Program can not read the contents of a small file that it has recently written!

For one thing, you're having precedence problems.
Either do

close FILE or die "die die";
or
close(FILE) || die "die die"; Oh, and spell your variables, "Lenght" had me chasing possible typo problems

Update: There's more to be done, but I'm not sure I have the strength

Real Update: You have a return in your subroutine while loop.
return if $length <= ++$pos;
so you never get to your close which is outside an infinite loop.

Replies are listed 'Best First'.
Re: Re: Program can not read the contents of a small file that it has recently written!
by lostcause (Monk) on Jun 26, 2001 at 03:32 UTC
    Ah yes, that's it.
    Related to the fact that I didn't fully understand the code I used from the last question, I've gone bright red :-/
    Change the line return if $length <= ++$pos; to the lines
    if ($length <= ++$pos){ close (PERMUTEOUT) ||die "Could not close $permutelist_filename: $ +!"; return ($permutelist_filename); }

    And it all works as expected. My apologies for wasting your time on this one and thanks to all of you for your help.