in reply to Use of uninitialized value in numeric lt (<)

Is there something wrong with this statement
No, but you're not declaring or setting $numArgs anywhere. Also you should use strict;