in reply to Re: uninitialized string variable
in thread uninitialized string variable
At the very least, the first step to debugging would be for the OP to print out (delimited) what was read, what the contents of $data looked like, etc.
In Section
Seekers of Perl Wisdom