I'm having a little trouble telling what's going on from the code you posted. I don't know the purpose of "FH", "SERVICES" or "$c", but I'm guessing that this bit of code is for updating your config file. The use of "$.", the input line number, as part of a hash key makes me think you might be storing or updating information in the config file based on line number, and that could be a source of your problem. If my guess is right, and your rolling your own config file updates this way, I suggest looking at
CPAN:Config::Simple. Scroll down to the headings on "SAVING/WRITING CONFIGURATION FILES", "CREATING CONFIGURATION FILES" and "MULTIPLE VALUES" and I think you might find that the package does just what you want.
Good luck with your project.