Greetings,

First of all, if you are running the script as it appears below, no
result is being shown because all your print statements are commented
out.

Without running this script, I don't see any logic problems with it. It
should do what you intend.

A couple suggestions for improving performance:

1) Don't read the first file into @Uusi. Instead open the file and read
it line by line, handling each line as you read. This will reduce your
memory requirements by roughly half.

2) If you find a match in the two files, immediately exit the for() loop.
Continuing to compare the rest of the lines is meaningless since $Loytyi
has already been set to 1.


Ken



On 20030924 13:18:44 +0300, [EMAIL PROTECTED] wrote:
> Hello all!
> 
> I have problems with comparing two big text files with eachother (~4Mb). 
> the script reads (or tries to read) both files into @tables and compare 
> them line by line after that, but no result is being shown. Script 
> searches for new productcodes ($Urivi[3]).
> 
> Is there any limit to @table size or what could be wrong?
> 
> 
> -------------------------------------
> //source:
> 
> foreach $tmp (@Uusi) {
>  $Loytyi = 0;
>  @Urivi = split "\t", $tmp;
> 
>    for ($i=0; $i<=$Vanhankoko-1; ++$i) {
>      @Vrivi = split "\t", $Vanha[$i];
> 
>      if ($Urivi[3] eq $Vrivi[3]) {
>        #print "Tuotekoodit t?sm??\n";
>        $Loytyi = 1;
>        $i = $Vanhankoko;
>      }
>    }  #end for
> 
>  if ($Loytyi == 0) {
>    #print "$Urivi[4] $Urivi[3]\n";
>    $temppi = $Uudettuotteet;
>    $Uudettuotteet = $temppi."=".$Urivi[4]."_".$Urivi[3];
>    $Loytyi = 0;
>  }
> }
> 
> 
> _______________________________________________
> Perl-Unix-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to