in reply to SPLIT()ing headache

I think the (or at least a) relevant part of your code is:
#HERE IS THE SPLIT PROBLEM AREA! $tparse=split(/-/,$current); $writer=$tparse['2'];
$tparse is a scalar, so split will return a number, like 3.

`perldoc -f split`

... In scalar context, returns the number of fields found and splits into the "@_" array. Use of split in scalar context is deprecated, however, because it clobbers your subroutine arguments.