Are you blind like me?
if (
test0 < 1)
Well, even though I am blind I can see that "test0" is not a scalar, and you have that same mistake elsewhere in your script (test).
use the warnings pragma with all your perl scripts:
use warnings;
it would have alerted you to these mistakes