Perl has an operator that does what you're asking for. It's the diamond operator, and when used 'empty', it reads each item listed in @ARGV sequentially. See perlop. Here's a snippet from the documentation:

The null filehandle <> is special: it can be used to emulate the behavior of sed and awk. Input from <> comes either from standard input, or from each file listed on the command line. Here's how it works: the first time <> is evaluated, the @ARGV array is checked, and if it is empty, $ARGV[0] is set to "-", which when opened gives you standard input. The @ARGV array is then processed as a list of filenames. The loop

Now you're presenting an X-Y problem: You have something you would like to accomplish, and you think that you have to solve how to open an unknown number of file handles up to possibly 10,000 to accomplish your primary objective. That's not what you need to solve. X is accomplish the objective. Y is how to get there. You're focusing on the wrong 'Y'. The diamond operator will automatically open one file after the other, sequentially, as you read from it. When one file finishes, it moves on to the next.

If your concern is knowing the filenames ahead of time, they're held in @ARGV before you start reading, and as you start reading, $ARGV will hold the name of the current file you're iterating over. $. will hold the current line of the file you're iterating over. So if you need to keep track of where you are in the process, you can rely on those special variables as hints.

So to reiterate, assuming there are no other command line arguments aside from simple filenames:

@ARGV will hold the list of filenames.

scalar(@ARGV) will tell you how many items @ARGV holds.

$ARGV will tell you which file the diamond operator is reading currently.

$. will tell you what line number you're on in that file.

<> will read from the first file in @ARGV, followed by the 2nd, and so on until there's nothing more to read.

A simple while( <> ) {.... } loop will "do the right thing" if the right thing is reading every line of every file on the command line.

How does that follow from your question? You have not shown that you need to open a separate file handle (at the same time) for everything in ARGV. We have pointed out that the diamond operator opens each one in turn, automatically. From the problem you presented, there is no reason to open the files all at the same time, and even if you did so, what would you do with them all?

But a direct answer to that question is: call open for each one. What's the big deal? Call open in a loop, or get fancier with a map statement.

Do you realize that you can use a variable as the file handle, rather than an old-fashioned GLOB thing? Maybe that's the part you are missing. I hesitate to show a complete example because you should not need to do that at all.

When putting a smiley right before a closing parenthesis, do you:

Use two parentheses: (Like this: :) )
Use one parenthesis: (Like this: :)
Reverse direction of the smiley: (Like this: (: )
Use angle/square brackets instead of parentheses
Use C-style commenting to set the smiley off from the closing parenthesis
Make the smiley a dunce: (:>
I disapprove of emoticons
Other