Your quite right, I got muddled thinking about the records coming back and being passed up, but the whole point of the OP was to put the entire file into a scalar. Lists, lazy or otherwise, have nothing to do with it.
Let's see if I've managed to get this through my somewhat thickening skull. (And to move down a level of abstratction).
- The file is opened within the do{} loop, and records are transfer to a temporary scalar variable
- The file finishes. The do{} loop passes the temporary back to the assignment
- The compiler has recognized (using the code tree?) that the temporary is only going to the assigned to a variable, $foo, and the $foo SV is set to point to the data from the temp SV; the temp SV is now available for the next use. Thus the data exists only once.
At least that's the way it's supposed to work, so the additional memory usage observed by Grandfather shouldn't happen.
Let me know if I've gotten this significantly wrong. (And thanks for the corrections, and your patientce when I got lost.)