in reply to Both read and write to file
Another strategy is File::Map, which maps a view of the arbtrarily-large file into your process’ memory space. The file itself now serves as a “buffer,” because what is actually happening is that, when virtual-memory page faults happen in this area of the process storage space, they are resolved by the operating system as direct accesses (by the operating system, on your behalf...) to that file.