Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Difference between File Handles and File Descriptors in function parameters.

by Skeeve (Vicar)
on Aug 11, 2011 at 14:45 UTC ( #919884=note: print w/ replies, xml ) Need Help??


in reply to Difference between File Handles and File Descriptors in function parameters.

If I read this Perl Cookbook Chapter 7 I don't see any advantage in using filedescriptors.

Perl's I/O system uses filehandles instead of file descriptors, so you have to make a new filehandle for an already open file descriptor.


s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
+.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e


Comment on Re: Difference between File Handles and File Descriptors in function parameters.
Select or Download Code
Re^2: Difference between File Handles and File Descriptors in function parameters.
by tusty (Novice) on Aug 11, 2011 at 14:57 UTC
    thanks for your response, So what exactly is a file descriptor?? somehow I find that no page I found really answers that question, they just talk about how to use it. Why would any one want to pass or return a file descriptor?

      A file descriptor is a number which specifies a IO stream. In Unix and other POSIX environments, there is an array called the file descriptor table, and you can use a number which indexes one of those entries: 0 is STDIN, 1 is STDOUT, 2 is STDERR ... the remainder you open yourself.

      See Wikipedia's explanation.

      As Occam said: Entia non sunt multiplicanda praeter necessitatem.

      A file descriptor is just a number local to your program, in effect enumerating your open files. Well known file descriptors are 0 (usually pointing to STDIN), 1 (STDOUT) and 2 (STDERR)

      I don't see any advantage in this case, but I'm no expert on this. Maybe it was a miscomunication and he just meant to use $fd filehandles instead of FD filehandles!?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://919884]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (10)
As of 2014-04-19 06:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (478 votes), past polls