in reply to Useless use of private variable in void context

$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:

  1. BTW: Please use  <readmore> tags when posting a large chunk of code such as that in the OP. Please see Markup in the Monastery.
  2. 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.