I have written a Perl script that takes an input hexadecimal value and then returns the binary equivalent. I need to sign that 8-bit integer and view the signed integer's value. This particular scenario does not seem to be covered in the Perl documentation that I have seen. The script is pasted below:
#! perl
use warnings;
print "Enter hexidecimal number:";
chomp ($hexNum = <STDIN>);
print $hexNum . "\n";
print join "\n", map { unpack ('B*', pack ('H*',$_)) } split ':',
$hexNum;
This question is not the same as other entries (specifically Converting hexadecimal numbers in strings to negative numbers, in Perl because it deals specifically with an 8 bit integer, not simply converting to decimal.