Perl计数器
发布时间:2020-12-15 23:43:49 所属栏目:大数据 来源:网络整理
导读:jrhapt01:/home/tomcat/sbin cat test.out 123456789101112131415You have new mail in /var/spool/mail/tomcatjrhapt01:/home/tomcat/sbin wc -l test.out 15 test.outjrhapt01:/home/tomcat/sbin cat test.pl open( D,"","test.out" ) || die "$!n"; whil
jrhapt01:/home/tomcat/sbin> cat test.out 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 You have new mail in /var/spool/mail/tomcat jrhapt01:/home/tomcat/sbin> wc -l test.out 15 test.out jrhapt01:/home/tomcat/sbin> cat test.pl open( D,"<","test.out" ) || die "$!n"; while (<D>) { $num++; print "$num is $numn"; } jrhapt01:/home/tomcat/sbin> perl test.pl $num is 1 $num is 2 $num is 3 $num is 4 $num is 5 $num is 6 $num is 7 $num is 8 $num is 9 $num is 10 $num is 11 $num is 12 $num is 13 $num is 14 $num is 15 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |