INP would have to be closed for the other file to be read in the subroutine

Why? The subroutine does not need to use the same file handle name INP, and you can certainly have two files open at the same time. There are limits, but 2 is reasonable. Just make sure you close the file handles - lexical handles will help with that, as it will with file handle name collisions:
open(my $inp, '<', $file_list) or die("Error reading $file_list: $!"); while (<$inp>) { ... } close $inp;
I also don't get why you are using an RE rather than chomp. Anyway, your assignment to $data_file probably does not do what you think it does - did you trty printing it out?

In reply to Re: Multiple files opened by Anonymous Monk
in thread Multiple files opened by kokakola613

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.