From my limited experience, filedescriptors ( the actual filehandle numbers) are useful because threads can access any open file under the same pid, via the fileno. Filehandles themselves are just a convenience on top of the file descriptors. See[threads] Open a file in one thread and allow others to write to it and FileHandles and threads. Everytime you open a filehandle, you get a filedesciptor underneath. On linux, you can look at /proc/$pid/fd and see all your filedescriptors sitting right there. You can use this fact to write to all open fd's you own, even from another process.

There may be use also, in passing filedescriptors off to forked processes. You just can't pass a filehandle, but a descriptor yes.

Other uses: to close ALL open filehandles, after having lost track of them. See How to close all open file descriptors after a fork? or the process of Duping filehandles Duping filehandles

So anyways, don't blow off filedescriptors as useless.


I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

In reply to Re: Difference between File Handles and File Descriptors in function parameters. by zentara
in thread Difference between File Handles and File Descriptors in function parameters. by tusty

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.