open my $fh, ">myfile"; # will truncate by opening it for write access truncate "myfile", 0; # will truncate (if it's implemented on your system) unlink "myfile"; # will remove it