in reply to Where are these newlines coming from?
If the file you are reading from contains newlines, the below code (yours) would not work. It would only chomp the last newline out.
You would need to do something such as:$_ = <FH>; chomp; if ($_) { my @file= split(/:/); %data = @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.my @file = <FH>; chomp @file; %data = split(/:/, join('', @file));
Then, I think this code looks a bit curious:
Don't you mean something like:@file = join(":",%data); print FH @file;
I don't think that matters all that much though.my $file = join(":", %data); print FH $file;
I just got up, so I'm a bit confused right now, but I'd look at these issues anyways. :)
|
|---|