> -----Original Message-----
> From: loody [mailto:[EMAIL PROTECTED]
> Sent: 08 October 2008 08:56
> To: Perl beginners
> Subject: Re: 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_file1,'Tie::File', $src_file1, mode => O_RDWR ,autochomp
=>
>  1 or die "cannot open file $!";
>  tie my @src_file2,'Tie::File', $src_file2, mode => O_RDWR ,autochomp
=>
>  1 or die "cannot open file $!";
>  if($#src_file1 != $#src_file2)
>  {
>         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
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> http://learn.perl.org/
> 
Spotted this,  it might   help you ?
Text::Diff

If all you need is confirmation that they are  different perhaps a
checksum might serve you better?

Also comparing  the  files with diff will probably be  quicker since  it
has been written to do exactly that.

Stu



Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and 
are used under licence. British Sky Broadcasting Limited (Registration No. 
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home 
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited 
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky 
Broadcasting Group plc (Registration No. 2247735). All of the companies 
mentioned in this paragraph are incorporated in England and Wales and share the 
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to