abstract:這篇文章主要介紹了Perl讀寫文件簡單示例,本文直接給出實(shí)現(xiàn)代碼!/usr/bin/perl -w use strict; #print "please input a string\n"; #my $line = <ST
這篇文章主要介紹了Perl讀寫文件簡單示例,本文直接給出實(shí)現(xiàn)代碼
!/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";#向文件寫入內(nèi)容 print FH "OK\n"; close(FH); #open a file open(FH, "aa.txt") or die $!; my @f = <FH>;#將文件內(nèi)容讀出 print @f; close(FH);
更多關(guān)于Perl讀寫文件簡單示例請關(guān)注PHP中文網(wǎng)(www.miracleart.cn)其他文章!