$buffer_high = 255; $buffer_low = 254; sub process_lcd { ... my $key = sysread (DisplayIO, $lcdValue, 1); return $lcdValue; } # end process_lcd # code then compares values for $lcdValue with $buffer_high and $buffer_low