That was a crude demonstration knocked up in haste. If you run it, you'll find that in addition what you've noticed, it also prints the lines double spaced.
This is due to the use of -l on the shebang line. Newlines are added when the lines are printed to the file and then again when they are read back and printed to STDOUT.
I took the liberty of discarding the spaces when posting. If you want a better version, try:
#! perl -sw
use strict;
use threads;
use threads::shared;
my $sem :shared;
open my $fh, '>:raw', 'junk.dat' or die $!;
$_->join for map {
async {
for my $i ( 0 .. 999 ) {
lock $sem;
seek $fh, $i*320 + ($_-1)*80, 0;
print $fh $_ x 79, "\n";
}
};
} 1 .. 4;
close $fh;
open $fh, '<', 'junk.dat' or die $!;
print while <$fh>;
close $fh;
__END__
C:\test>t-write.pl
1111111111111111111111111111111111111111111111111111111111111111111111
+11111111
2222222222222222222222222222222222222222222222222222222222222222222222
+22222222
3333333333333333333333333333333333333333333333333333333333333333333333
+33333333
4444444444444444444444444444444444444444444444444444444444444444444444
+44444444
1111111111111111111111111111111111111111111111111111111111111111111111
+11111111
2222222222222222222222222222222222222222222222222222222222222222222222
+22222222
3333333333333333333333333333333333333333333333333333333333333333333333
+33333333
4444444444444444444444444444444444444444444444444444444444444444444444
+44444444
1111111111111111111111111111111111111111111111111111111111111111111111
+11111111
2222222222222222222222222222222222222222222222222222222222222222222222
+22222222
3333333333333333333333333333333333333333333333333333333333333333333333
+33333333
4444444444444444444444444444444444444444444444444444444444444444444444
+44444444
1111111111111111111111111111111111111111111111111111111111111111111111
+11111111
2222222222222222222222222222222222222222222222222222222222222222222222
+22222222
3333333333333333333333333333333333333333333333333333333333333333333333
+33333333
4444444444444444444444444444444444444444444444444444444444444444444444
+44444444
1111111111111111111111111111111111111111111111111111111111111111111111
+11111111
2222222222222222222222222222222222222222222222222222222222222222222222
+22222222
3333333333333333333333333333333333333333333333333333333333333333333333
+33333333
4444444444444444444444444444444444444444444444444444444444444444444444
+44444444
1111111111111111111111111111111111111111111111111111111111111111111111
+11111111
2222222222222222222222222222222222222222222222222222222222222222222222
+22222222
3333333333333333333333333333333333333333333333333333333333333333333333
+33333333
4444444444444444444444444444444444444444444444444444444444444444444444
+44444444
1111111111111111111111111111111111111111111111111111111111111111111111
+11111111
2222222222222222222222222222222222222222222222222222222222222222222222
+22222222
3333333333333333333333333333333333333333333333333333333333333333333333
+33333333
4444444444444444444444444444444444444444444444444444444444444444444444
+44444444
1111111111111111111111111111111111111111111111111111111111111111111111
+11111111
2222222222222222222222222222222222222222222222222222222222222222222222
+22222222
3333333333333333333333333333333333333333333333333333333333333333333333
+33333333
4444444444444444444444444444444444444444444444444444444444444444444444
+44444444
1111111111111111111111111111111111111111111111111111111111111111111111
+11111111
2222222222222222222222222222222222222222222222222222222222222222222222
+22222222
3333333333333333333333333333333333333333333333333333333333333333333333
+33333333
4444444444444444444444444444444444444444444444444444444444444444444444
+44444444
1111111111111111111111111111111111111111111111111111111111111111111111
+11111111
2222222222222222222222222222222222222222222222222222222222222222222222
+22222222
3333333333333333333333333333333333333333333333333333333333333333333333
+33333333
4444444444444444444444444444444444444444444444444444444444444444444444
+44444444
...
Note: I truncated some of the output when posting.