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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |