for (my $ofs = 0; $ofs < length $wbuf; ) { $ofs += (my $wr = syswrite $fh, substr $wbuf, $ofs or die "unable to write results"); }