$tiu => $min && $tiu < $max
My guess is, this statement (on the lines mentioned in the warnings) should be
$tiu>= $min && $tiu < $max
Note that => is the 'fat comma', not the >= 'greater than or equal to' comparator.
Updates:
-
BTW: Please use <readmore> tags when posting a large chunk of code such as that in the OP. Please see Markup in the Monastery.
-
The statement
$tiu => $min && $tiu < $max
in scalar context (as imposed by the if conditional) is the same as
($tiu, $min && $tiu < $max)
in which the $tiu scalar is evaluated and its value is thrown away (i.e., 'used uselessly'), and then the clause $min && $tiu < $max is evaluated and becomes the final value of the statement. I doubt the latter clause is what you intended.