Hi,

If you want just know there was a change, go with File::Compare mentioned above.

I think you probably need to know what files were added and removed, in other word difference between your file list. You can try following approach:

First make sure your lists in files are sorted. Then use Text::Diff module like this:

use Text::Diff; my $diff = diff "saved_system.txt", "current_system.txt", { STYLE => " +OldStyle" }; my (@added,@removed); for(split /\n/,$diff) { next if /^\d/; # skip line numbers push @added,$1 if /^> (.*)$/; push @removed,$1 if /^< (.*)$/; } print "Added files:\n"; for my $file (@added) { print $file,"\n"; } print "\nRemoved files:\n"; for my $file (@removed) { print $file,"\n"; }

It prints output to console, but it is easy to change for printing into file.

-- hope this helps, Roman


In reply to Re: comparing lines in two files by bobr
in thread comparing lines in two files by Baphi

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.