>>>>> "DSam" == Sam Vilain <[EMAIL PROTECTED]> writes:

DSam> Randal L. Schwartz wrote:
>> my $first_free = do { open my $x, ">&STDERR"; fileno $x };
>> Yes, it's not the same as the number currently in use, but it's a
>> cheap number to get.
>> 

DSam> If you're on Linux (or Solaris IIRC) you could always use:

DSam>   my $num_fh = $#{[</proc/$$/fd/*>]}+1;

Not even sure that's the same thing.  If 0, 1, 2, 11, and 15 are open,
does that return 3?  Or 5?  Is it finding the first free fd, or one
more than the count of open fds?

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

Reply via email to