Perl读写文件简单示例
程序员文章站
2022-06-27 14:07:07
!/usr/bin/perl -w
use strict;
#print "please input a string\n";
#my $li...
!/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);
下一篇: Perl初学笔记之Hello World