use strict; use warnings; use Fcntl 'SEEK_SET'; system "touch myfile"; open my $fh, '+<', 'myfile'; syswrite $fh, 'A' x 100000, 100000; sysseek $fh, 0, SEEK_SET; syswrite $fh, 'B' x 10, 10, 0; close $fh;