Simply open the file for writing -- that will automatically truncate it.
open FILE, '>', 'sample.txt' or die "Could not open sample.txt: $!"; close FILE;
Update: I second the recommendation for logrotate.
In reply to Re: Deleting on Files
by friedo
in thread Deleting on Files
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |