Why do you need a tie?
Take a look at the modules:
Text::Diff
Algorithm::Diff
or the UNIX 'diff' or 'comm' utilities for a simpler solution.

HTH,

Timur Shtatland

On Oct 8, 3:54 am, [EMAIL PROTECTED] (Loody) wrote:
> Dear all:
> I try to compare 2 files line by line.
> I use tie::file to save 2 files as array and compare them one line by one 
> line.
> the perl is like below:
>
>   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 $!";


>   for(my $index=0; $index <= $#src_file1;$index++)
>   {
>      if($src_file1[$index] != $src_file2[$index])
>      {
>         printf "The 2 files are different\n";
>         exit;
>      }
>   }
>
> But I find the process is pretty long.
> Both files are about 10MB.
> Is there any quicker way to do the same thing above?
> appreciate your help,
> miloody


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


Reply via email to