in reply to use of uninitialized value

The advice of Anonymous Monk above is all excellent, but this for one thing will not fly.

($a,$b)=split ("\t"); $a=@a; $b=@b;
Whatever you have in $a and $b after the split is immediately turned to 0 by assigning empty arrays to those variables.