in reply to Re^3: Caching files question
in thread Caching files question

please let me know what you mean by "using lexically scoped file handles".

I'm just saying that if your code is currently written like this:

open( FH, "<some/path.name" ); while (<FH>) { ... } close FH;
It will have to be changed to something like this:
my $fh = myOpen( "<", "some/path.name" ); while (<$fh>) { ... } close $fh;
(In other words, you need to use a scalar variable instead of a GLOB as the file handle, and as a rule, scalar variables should be lexically scoped by declaring them with "my".)

No, you don't have to open the files directly in your Script1.pl; it will be best for Script3.pl to have the %cache hash all to itself, as well as all the file opening and reading. Be sure to use strict; and declare with "my".

Naturally, when your "main" script finishes and exits, all the ram it used is returned to / freed by the OS, no matter how many script files and data files were loaded by your script while it was running. (If you were referring to something else in your last question, I'm sorry if I misunderstood.)