in reply to Why is this comparison failing?

Your calculation results in a floating-point numeric result which you are comparing to an integer. Change:
my $adjusted_hue = $hues[$index] + ($scaled_index - $index)*($hues +[$index + 1] - $hues[$index]);
to:
my $adjusted_hue = sprintf '%d', $hues[$index] + ($scaled_index - +$index)*($hues[$index + 1] - $hues[$index]);