in reply to writing to the top of a file
Unrelated to Perl, filesystems typically don't provide functionality for that to happen transparently. What you need to do is read out the old file content into memory, insert the new data at the beginning (Perl's scalars or arrays are offering this in a nice transparent way) and then write the whole blob back to disk.
|
|---|