Since you haven't posted a sample of the file you're parsing or given a clear and accurate description of its format, it's impossible for us to say why your parsing is failing.
Start by adding these 2 pragmas (which should be in every Perl script you write) and do the best you can on fixing the problems that they point out.
Code:
use strict;
use warnings;
Then post your script and a sample of the file that you're parsing and the errors and warnings that your script generates.