in reply to Illegal hex digit '

We just answered this for you.

$value contain the newline from pressing Enter. Use

chomp( my $value = <STDIN> );

to remove any trailing newline.

Ref: chomp

By the way, you'll probably never want to do func("$var"). Just use func($var).