perl学习(一)

前端之家收集整理的这篇文章主要介绍了perl学习(一)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

perl 读写文件

perl 读文件

open(FILE,"filename.txt");

my $record;

while($record=<FILE>)

{

print("file record is : $record\n");

}

close(FILE);

perl 写文件

覆盖写入

open(FILE,">filename.txt");

syswrite(FILE,"This is my write file contents\n");

close(FILE);

追加写入

open(FILE,">>filename.txt");

syswrite(FILE,"This is my write file \n");

syswrite(FILE,"This is my write file contents \n");

close(FILE);

猜你在找的Perl相关文章