1 use strict; 2 use warnings; 3 4 5 #将读入的内容添加到原字符串后面 6 my $buffer='START:'; 7 my $byts = sysread(STDIN,$buffer, 10, length($buffer)); 8 #my $byts = read(STDIN,$buffer, 10, length($buffer)); 9 print $buffer," "; 10 11 #将字符串添加到文件后面 12 open(FD, ">1.txt"); 13 syswrite(FD,$buffer,10,2); 14 close(FD); 15
#sysread无缓冲/read有缓冲
#print有缓冲/syswrite无缓冲
#systead可设置追加偏移量
#syswrite可设置写入长度与开始写入的位置