No, because perl can only have 256 handles open at once and they have to be named in capital letters and there are only 26 of those.

If you want to open more files you can use ruby which has first-class filehandles

@list #contains list filenames @handle = @list.map {|n| File.new(n) } for h in @handle @data = h.readlines end
or gawk which hides filehandles away so you only need to handle filenames. (Update: you could use octave if you insist on the "end for" bit.)

There's also a trick (ref. 483243 and 544184) to open multiple files: `cat filename1 filename2` but that only works in unix and has to read everything to memory so I don't recommend to do it in production code.

(This reply is meant to be a bad joke. Don't take it seriously, instead read holli's reply. I think too that this is an XY problem. You can open multiple filehandles simultanously, using lexical filehandles (or Symbol). There's however no need for that if all you want is to read the data from all of them, as you can open the files sequentially: you can reuse a filehandle by reopening it (which will close the previous file).)


In reply to Re: Opening multiple files by ambrus
in thread Opening multiple files by Chon-Ji

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.