首页 > 编程 > Perl > 正文

Perl读写文件简单示例

2020-10-31 14:51:41
字体:
来源:转载
供稿:网友

!/usr/bin/perl -w use strict;  #print "please input a string/n"; #my $line = <STDIN>; #print $line;  #wirte a file open(FH, ">aa.txt") or die $!;  print FH "hello/n";#向文件写入内容 print FH "OK/n";  close(FH);  #open a file open(FH, "aa.txt") or die $!; my @f = <FH>;#将文件内容读出 print @f;  close(FH);

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表