There are plenty of articles explaining how to write to a file and how to write to a file.

We also have articles on how to read and write and if you already know how to install Perl modules then there is also the use of Path::Tiny to read and write files.

However rarely do we see articles explaining how to append to the beginning of a file or how to append to the top of a file.