Warren Cashen wrote: > > > > > > > Is there a way to increase the number of files open at one > > time? The > > > current maximum of my installation is 510. I am using > > ActivePerl 5.6.1 on > > > Windows 2000. > > > > Hi Warren. > > > > That's most likely to be a Windows limit rather than a Perl > > limit. My guess > > is that it's a nine-bit value, being 510 files + STDIN + > > STDOUT = 512 or > > 0x200. > > I can open more than 510 files at a time using ActiveTcl on the > same Windows box. > > > > > What error do you get when you exceed the limit? > > > > I only get the error message from the "die" part of the statement. I am > new to Perl and do not know how to get further error diagnostics. If I > remove > the die part of the statement, the files simply aren't opened after number > 510. > > > And, the obvious question is, why do you need so many files > > open? There > > may well be a better solution to you problem. > > > > There may be. I am using the script to break down a large file into smaller > files > that are more manageable for visualization purposes. Each line of the large > file is > written to another file based on its content. I'd like to get the file > "visualized" in > the next day or two, so I'd prefer not to start rewriting the script if > there is an > easy way to increase the number of files I can have open at any given time.
Then I think you have three and a half options: 1 Rebuild Perl with the appropriate option changed. (Although I can't guarantee that such an option exists. I've never come across it, but I've also never looked for it. 2 Open each file for append, write the data to it, and close it again. Depending on your data this may run acceptably quickly. 3 Maintain a cache of open file handles and, when you need to write to a file, check to see if it's already open. If so then just use the handle. If not then close the least recently used handle, open a new one and put it in the cache. 3a Analyse your data in a first pass to see which are most frequently written files, without actually doing any writing. Then open the most popular 32 (say) and treat all the rest as in option 2. 1 may not even be possible. 2 will be the easiest to get working, but may be too slow. 3 will run quicker but may be tough to debug. 3a is a compromise. HTH, Rob _______________________________________________ ActivePerl mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
