perl如何只清除文件内容而不删除文件?

perl如何只清除文件内容而不删除文件?

perl如何只清除文件内容而不删除文件?
Perl有没有什么命令可以做这样的事,把内容清空但不用删除文件!
谢谢指教!
truncate.
truncate
Thanks!--Truncate(File.
Thanks!
Truncate(File, 0);内容清空后,再写入内容时跟重新OPEN的文件好像不一样?
truncate FILEHANDLE,LEN.
truncate FILEHANDLE,LENGTH
truncate EXPR,LENGTH
Truncates the file opened on FILEHANDLE, or named by EXPR, to
the specified length. Produces a fatal error if truncate isn't
implemented on your system. Returns true if successful, the
undefined value otherwise.

The behavior is undefined if LENGTH is greater than the length
of the file.

The position in the file of FILEHANDLE is left unchanged. You
may want to call seek before writing to the file.
?
open (FILE,">123.txt");
close(FILE);
open(FileHand,">文件名")这个是把文件中的内容都清除了,但文件还在
open(FileHand,">>文件名")是接着原有的内容写
创建一个新的文件覆盖掉他.
创建一个新的文件覆盖掉他就可以了。