use warnings;
use strict;
open FH,"test.txt";
open RESULT,">result.txt";
open LINE,">line.txt";
open LEN, ">length.txt";
while (<FH>)
{
#chomp;
print RESULT "line $. is $_";
print LINE "line $.\n";
my $leng=length$_;
print LEN "The length of line $. is $leng n";
}
close FH;
test.txt as follow
1 1 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2 2
3 3 3 3 3 3 3 3 3
https://m.sciencenet.cn/blog-682293-541044.html
上一篇:
Linux下升级R软件下一篇:
perl Getopt::Long