PDA

View Full Version : how do you dup file descriptors in PERL?


nrabinov
07-03-03, 09:09
I have been searching for ways to manipulate file descriptors in PERL, but so far I have found that there is a lot of information about manipulating file handles, and next to none about file descriptors.

What I need is a function that does the same thing as the UNIX shell dup2() function. There is no such function in PERL, escept for the fctrl() function, for which I have not been able to find any meanigful information.

Can anyone please advise.

Thanks

Bernd Dulfer
07-08-03, 05:37
Something like:

open FILE1, ">/tmp/file1";
open FILE2, ">&FILE1";

should do what you want.

nrabinov
07-08-03, 06:15
Thanks.