my $hex= "FFAA"; my $unsigned= hex($hex); my $signed= $unsigned; $signed -= 0x10000 if $signed & 0x8000;