open TEST, "+> /tmp/output"; # uses File Descriptor 3 POSIX::close(3); # closes the file, but TEST # is still linked to FD 3 open TEST2, "+> /tmp/output2";# uses FD 3 since it is # avaliable again print TEST "Testing\n"; # Will be written to output2 close TEST2; # does not close the file, # because perl thinks TEST # still has it open. close TEST; # Now output2 is closed # and both file handles are # closed properly