Looking at the code for File::Slurp I'm stunned by how complicated it is. I have absolutely no idea if it's safe or not!
Why not just open() the file yourself and write to it? I can guarantee that's safe as long as you don't use any user input to construct your filenames.