parthu_r has asked for the wisdom of the Perl Monks concerning the following question:
Here is the code which I wrote
But this code comapes the lastline in the array.# # Compaing the output and the excepted # open FILE, "expected.txt" or die "can't open:$!"; @lines=<FILE>; $x=@lines; foreach $x1 (@lines) { $COMMAND1 =$x1 ; chomp($COMMAND1); } open FILE1, "output.txt" or die "can't openeee:$!"; @lines1=<FILE1>; $x1=@lines1; print $x1; foreach $x2 (@lines1) { $COMMAND2 =$x2 ; chomp($COMMAND2); } if($COMMAND1 eq $COMMAND2) { print "The clt has $COMMAND has Passed "; open(Trace1, ">>Passed.log"); $p1 ="The clt $COMMAND has passed \n"; print Trace1$p1,"\n"; } else { print "The clt $COMMAND has failed "; open(Trace2, ">>Failed.log"); $p2="The clt $COMMAND has failed \n"; print Trace2$p2,"\n"; }
Is there any way I can compare the entire content.
Sarathy
Edit by dws to add <code> tags
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Compare the content of two files
by dws (Chancellor) on Jul 30, 2002 at 18:26 UTC | |
Re: Compare the content of two files
by Ferret (Scribe) on Jul 30, 2002 at 18:30 UTC | |
Re: Compare the content of two files
by Rich36 (Chaplain) on Jul 30, 2002 at 18:23 UTC |