$max = ($x < $max) ? $max : $x; # similar for min