in reply to Re^2: Random read/write on a block device
in thread Random read/write on a block device

passing unused data to syswrite() seems like an odd thing to do.

Since you can't control how many bytes actually get written, it makes it very easy to use syswrite:

my $to_write = length($msg); while ($to_write) { my $written = syswrite($fh, $msg, $to_write, -$to_write) or die "syswrite: $!\n"; $to_write -= $written; }