http://www.perlmonks.org?node_id=955699


in reply to Text::Diff help

If you change the line to

my $diff = diff "output.new", "output.new", { STYLE => "Unified" , OUT +PUT => \*DIFF };

what is the output then? If you see the whole file the diff module is implicated. If not, it could mean there are white space differences in your files. Did you check the files with the diff command line tool?

UPDATE: You never close the file output.new after you write to it. The data is probably still in the buffer waiting to be written to disk when you do the diff (disk operations are buffered so that not every write of a single character rewrites a whole disk block). Only after the script finishes, close is called automatically and the contents written

Replies are listed 'Best First'.
Re^2: Text::Diff help
by whittick (Acolyte) on Feb 23, 2012 at 11:35 UTC

    Thanks for pointing out the 1.log and 2.log moritz, that was from a previous attempt so cretainly won't help!

    Thanks for all the pointers about closing my filehandle, I'll give that a go!

      working perfectly now - thanks!