in reply to Fastest way of changing the beginning of a txt file..

You can try Tie::File (https://perldoc.perl.org/Tie/File.html)

The file is not loaded into memory, so this will work even for giganti +c files. Changes to the array are reflected in the file immediately.

Replies are listed 'Best First'.
Re^2: Fastest way of changing the beginning of a txt file..
by haukex (Bishop) on Feb 19, 2019 at 18:15 UTC
    You can try Tie::File

    Unfortunately, Tie::File adds significant overhead, so it's pretty safe to assume that it would slow things down and burn more memory.