use NativeCall;subtruncate(Str, int32 --> int32) is native {*}subMAIN (Str $file, Int $to) {given $file.IO { .e ordie"$file doesn't exist"; .w ordie"$file isn't writable"; .s >= $to ordie"$file is not big enough to truncate"; }truncate($file, $to) == 0 ordie"Truncation was unsuccessful";}