in reply to File comparison problem!

What happens when you run diff or cmp on the two files?

Replies are listed 'Best First'.
Re: Re: File comparison problem!
by Elijah (Hermit) on Dec 01, 2003 at 23:38 UTC
    Ok I have figured out why it is not passing the comparison. For some reason the following code is inputting one new line to many at the end of the file.
    open (TEMP, ">compare") || "Cannot open compare!\n"; print TEMP $t->get("1.0", "end"); close(TEMP);
    Why would this be doing that and how can I fix the issue or at least work around it?
      Either print() is adding an extra newline (because you have the output record separator $\ set to "\n", e.g. if you are using perl's -l switch), or the extra newline is added by $t->get(), in which case you need to tell us more about what $t and get() are.
        Well $t is defined as the following:
        my $t = $mw->Scrolled("Text", -scrollbars => 'e')->pack (-side => 'bottom', -fill => 'both', -expand => 1);
        It is a scrolled text box and the get() function loads the contetnts of $t into the filehandle TEMP which is actually the file called "compare". Does this help?
        Yes it is the $t->get that is inserting the new line at the end. Is there any way to get around this? Or how could I remove the last line before comparison?