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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.