perl学习(5)输入输出

一:  print

二:  文件句柄输入输出流

1:  读文件 “<”

    

    在当前目录下打开文件名为sim.log的文件,文件句柄LOG代表perl的进程,在这里代表文件sim.log。

    “<”为读取文件

2:  写入文件 “>”

    open(LOG, ">", $file) or die "can not open the file for writing\n\n";

    打开文件file,“>”代表写入;若文件不存在,则新建一个文件再写入;“>>”表示追加写入

 

    

posted on 2018-03-24 20:27  huanm  阅读(433)  评论(0编辑  收藏  举报