File::Temp can be used to create and open temporary files in a safe way.
