perl学习(5)输入输出

一:  print

二:  文件句柄输入输出流

1:  读文件 “<”

    

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

    “<”为读取文件

2:  写入文件 “>”

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

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

    

原文地址:https://www.cnblogs.com/xh13dream/p/8641305.html