Perl: the Markov chain saw | |
PerlMonks |
Re^5: Bad file descriptor when trying to close file handleby ikegami (Patriarch) |
on Mar 03, 2022 at 15:27 UTC ( [id://11141806]=note: print w/replies, xml ) | Need Help?? |
A bit more on this. Files exists independently of directory entries in unix. Think of them as being referenced-counted. They exist as long as they are referenced by a directory entry or by a file handle. This means you can have "anonymous files". perl -i uses this (which is why it doesn't work on Windows without an extension). File::Temp creates these by default. ls -l even shows how many times a file is referenced by a directory entry (second column). For plain files, it's usually one. For directories, it should be more than one.
See how .. is referenced by three directory entries? Those are /home, /home/. and /home/ikegami/.. See how . is referenced by ten directory entries? Those are /home/ikegami, /home/ikegami/., /home/ikegami/bin/.., /home/ikegami/usr/.., etc.
In Section
Seekers of Perl Wisdom
|
|