Does this give the error:
open my $file, '+>', 'testfile' or die "Can't write testfile: $!\n";
print $file 'test!';
seek $file, 0, 0;
print <$file> . "\n";
seek $file, 0, 0;
truncate $file, 0 or die "Can't truncate testfile: $!\n";
close $file or die "Can't save testfile: $!\n";
If so, what's the error? truncate says that if truncate isn't implemented it's a fatal error, but I'm not sure what OSes that would include.
BTW, it's usually a good idea to show us what you've tried so we can work from that.