Update Valid.pm

In some case _rearrange breaks with an error about @params[0] uninitialized in line 78. Test @params instead of $params[0] is not enough.