local *F; open (F, ">$file") || die "Error opening $file: $!\n"; my ($id, $obj); while (($id, $obj) = each %$all_instances) { my $class = ref($obj); my @attrs = $obj->get_attributes(@{$this-> get_attrs_for_class($class)}); ### I discovered that after this line of code, ### it either closes the file or redirects the ### file descriptor. my @array = ($class, $id, @attrs); Storable::store_fd (\@array, \*F); } close(F);