develooper Front page | perl.beginners | Postings from October 2008

how to count line numbers in file quickly?

Thread Next
From:
loody
Date:
October 8, 2008 00:47
Subject:
how to count line numbers in file quickly?
Dear all:
I try to write a perl to compare whether the line numbers of 2 files
is equivalent.
Below is my source code:

tie my @src_file,'Tie::File', $src_file, mode => O_RDWR ,autochomp =>
1 or die "cannot open file $!";
tie my @src_file,'Tie::File', $src_file, mode => O_RDWR ,autochomp =>
1 or die "cannot open file $!";
if($#src_file != $#src_file)
{
	printf "The 2 files line numbers are different\n";
	exit;
}

but I find the time will be quite long when these 2 files are large,
each about 12MB.
I there quicker way to meet the same requirement?
appreciate your help,
miloody

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About