peral 读取路径的txt文件。

来源:互联网 发布:芜湖网络买花花店 编辑:程序博客网 时间:2024/05/16 15:03


$textname="C:/testPerl.txt";  #例如$textname="E:/lqf.txt"; open(FILE1,$textname);#打开文件  @line=<FILE1>;#将文件的每一行读取到数组@line中,文件的每一行作为一个数组元素close FILE1;print @line;
保存为:testPerl.pl

在c盘目录下面

cmd 命令下:  perl   testPerl.pl


0 0
原创粉丝点击