Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: Opening multiple filehandlers

by AgentM (Curate)
on Apr 06, 2001 at 21:00 UTC ( [id://70518] : note . print w/replies, xml ) Need Help??

in reply to Opening multiple filehandlers

Be very careful with this! While you may have a legitimate reason for doing this, you can hardly anticipate its failures as cross-platform code. The standard DOS install allowed for 20 file descriptors system-wide! That means that opening 100 would merely crash your program. You would effectively be left with 17 or less file descriptors. On modern OSs, each program may be limited to a certain no. (minimally X by POSIX (Petruchio has my book on this)) and also the system-wide total. It might simply be better to open each file in the loop, output the info, close the filehandle and reuse it.
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.

Replies are listed 'Best First'.
Re: Re: Opening multiple filehandlers
by extremely (Priest) on Apr 06, 2001 at 23:34 UTC
    Historically, many unices are set to either 128 or 256. These days I believe Linux is most often at either 256 or 1024 depending on the distribution and sysadmin tinkering. AFAIK the *BSD family tend to 256. I am unaware of PC or Mac defaults and whether they can be changed. IRIX was 256, Sun was 256, HP was 256; last I checked. If you keep it reasonable, say less than 100 you seem to be ok just about everywhere but the pathological cases.

    $you = new YOU;
    honk() if $you->love(perl)