in reply to How to get the fd from socket perl call?.

This is a perfectly legal use for the fileno function. In UN*X, you are guaranteed that all new file descriptors are unique and static throughout their use. Perl wouldn't dare mangle these numbers (they are, after all, just ints). So cast that variable to an int using perlembed and some *_*_SV(...) magic and you're ready to fly! Be sure to be pedantic and die if fileno returns undef, though. Enjoy the benefits of a fine operating system.
AgentM Systems nor Nasca Enterprises nor Bone::Easy nor Macperl is responsible for the comments made by AgentM. Remember, you can build any logical system with NOR.