in reply to Illegal hex digit '

It's displaying the newline at the end of the user input (you hit enter, right?). Use chomp to get rid of it:
chomp( my $value = <STDIN> );