You can't figure out what the program is supposed to do, eh?
My first recommendation is to understand what the problem
is and re-write the solution. If you guess it will take
you a month to 'fully nurse that thing' then i guess it
will take about a week to re-write it. Maybe you could
take advantage of CPAN modules even.
jeffa