I have the following code that tries to tie arrays to files. Except, when I run this code, it only creates 2045 files. What is the issue here?
#!/usr/bin/perl use Tie::File; for (my $i = 0; $i < 10000; $i++) { @files{$i} = (); tie @{$files{$i}}, 'Tie::File', 'files//tiefile$i'; }
Edit: I am on windows
You are accumulating open file handles (see
ulimit -n,setrlimitRLIMIT_NOFILE/RLIMIT_OFILE), and you ultimately hit a 2048 open file descriptors limit (2045 +stdin+stdout+stderr.)Under Windows you will have to rewrite your application so that it has at most 2048 open file handles at any one time, since the 2048 limit is hard limit (cannot be modified) in MSVC’s
stdio.