站长资源脚本专栏
Perl读写文件简单示例
简介!/usr/bin/perl -wuse strict;#print "please input a string\n";#my $line = ;#print $line;#wirte a fileopen(FH, ">aa.txt") or die $!; print FH "he
!/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中的子程序学习笔记