in reply to truncate or trunc
What errors do you have?
This works for me:
open my $fh, "+<", $filename or die $!; truncate $fh,$pos or die $!; [download]
or directly
Hope this helps
citromatik