in reply to Text file got corrupted?

It happened to me. I guess that I would try to read about using -T at the SheBang (#!/usr/bin/perl -wT).

And did you consider using ? ...

use CGI::Safe   qw/:standard taint/;

You could make the compiler advise you more precisely to your situation by pointing out the lines that are nor written securely. And if you can't solve those situations you can always copy your conflicting code here... Or, remove the -T and forget about the complains until you understand them better. (You'ld better not :)