in reply to Text::Diff help

rename "output.new","output.old"; ... diff "output.new", "output.old", ...

If the rename call succeeded (you should really check that, or use autodie), then output.new doesn't exist anymore. I guess that diff just treats is as empty, which is why it shows you that the whole contents of the second file as output (the diff is really the whole file).

Also it seems odd to me that once you compare 1.log and 2.log, and then based on the result of that comparison, you report the difference between two different files. But you might have your reasons for that.

Replies are listed 'Best First'.
Re^2: Text::Diff help
by choroba (Cardinal) on Feb 23, 2012 at 10:43 UTC
    It exists, because a pair of lines later,
    open OUTPUT, ">output.new" or die $!;
    But it is empty.

    Update: Heh, I should have read the whole code :-) The file is even being written to, but as jethro noticed, its handle is not closed, so the "expect" line is probably still in the buffer.