in reply to Re^6: Clear the contents of the text file
in thread Clear the contents of the text file

You were already given the answer. You get that error because you don't have the Path::Tiny module installed.

Note that you do not need Path::Tiny, or any module, to read in the lines from a file, or to "clear the contents of the file." You can do it without additional modules, including by using Perl's built-int truncate function, as roboticus told you in the first response to your question.

The way forward always starts with a minimal test.