note: NOT working version.  Turning on perl 'strict' and finding MANY critical scope issues.  Code changed to syntactically correct but will require futher analysis to get into correctly working state.