I am trying to get diff of two .slk files. For which I am reading the slk file and putting them into an array in the required format. After that I am using the Text::Diff module to get the difference.
sub ReadFileToArray($@) { ($fileName,$NotFormattedFile) = @_; @LineContents = (); @contents_Array = (); $Line = ""; $var = '"'; open (MyFileHandle,"$fileName") or die("File Not Found"); while($Line=readline(MyFileHandle)){ push (@$NotFormattedFile,$Line); $Line =~ s/$var//g; @LineContents = $Line; if($Line =~ m/^C;/i) { $Line =~ s/K/ / ; @LineContents = split(';',$Line); shift(@LineContents); shift(@LineContents); shift(@LineContents); } push (@contents_Array,@LineContents); } close (MyFileHandle); return @contents_Array; } @File1 = ReadFileToArray("$path1"."\\1.slk",\@File1_NotFormat); $s1 = @File1; @File2 = ReadFileToArray("$path2"."2.slk",\@File2_NotFormat); open (MYFILE1, ">>C:\\1_ERROR.txt"); print MYFILE1 @File1; open (MYFILE2, ">>C:\\2_ERROR.txt"); print MYFILE2 @File1; $Textdiff = diff \@File1, \@File2; print $Textdiff;
It seems to work for most of the files except for some, where i get the size of the array ($s1) to be 21737. Also the complete array is not writted to the file and then the Text::Diff seems to get stuck.Don't know if its a memory problem or some other issue...?
In reply to Text:Diff seems to get stuck by stavan2003
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |