in reply to Where are these newlines coming from?

Well, for the first thing, chomp removes whatever is in $/, right? And CGI.pm does manipulate that variable around, although it uses local in some places, and restores the old value in other places, so without premature returning, I can't see how that would affect it. $/ should be properly set on whatever platform you are running your script on, but if you like, you could try to set it manually to whatever is fitting, before you chomp. Probably something like $/ = "\r\n"; on windows.

If the file you are reading from contains newlines, the below code (yours) would not work. It would only chomp the last newline out.

$_ = <FH>; chomp; if ($_) { my @file= split(/:/); %data = @file; }
You would need to do something such as:
my @file = <FH>; chomp @file; %data = split(/:/, join('', @file));
That would read all the separate lines, chomp each of them and then join the result together before splitting on /:/ like before. If you have prepared the file you are testing against by hand, or moved it from another platform, this might well be the issue. Also, if you are moving a file between platforms via ftp, transfer them in ASCII mode, for newline translations.

Then, I think this code looks a bit curious:

@file = join(":",%data); print FH @file;
Don't you mean something like:
my $file = join(":", %data); print FH $file;
I don't think that matters all that much though.

I just got up, so I'm a bit confused right now, but I'd look at these issues anyways. :)