Perl讀寫文件簡單示例
更新時間:2015年04月14日 09:28:12 投稿:junjie
這篇文章主要介紹了Perl讀寫文件簡單示例,本文直接給出實現(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";#向文件寫入內容 print FH "OK\n"; close(FH); #open a file open(FH, "aa.txt") or die $!; my @f = <FH>;#將文件內容讀出 print @f; close(FH);
相關文章
perl之print,printf,sprintf使用案例詳解
這篇文章主要介紹了perl之print,printf,sprintf使用案例詳解,本篇文章通過簡要的案例,講解了該項技術的了解與使用,以下就是詳細內容,需要的朋友可以參考下2021-09-09