in reply to Errors on Parser help

It would be helpful if you provided us with some sample data. But what this message means is that your regexp did not match something that you expected it to match. It's tough to help debug a regexp when we don't know what the sample data looks like.

Also, you checked the return value of your first open (although you didn't explicitly specify weather you are opening it for read/write/both which is a good habit to be in):

open (DATA, $txtfile)||die "cannot open $txtfile for reading";
But you didn't check the return value of the second open:
open (OUT, ">$txtfile.redo");
You should rewrite both of your open's to use the 3 argument form and always check the return values:
open(DATA, ">", $txtfile) or die "File open error: $!";