Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting hex into binary

Status
Not open for further replies.

dipti1

Programmer
Jul 25, 2006
9
US
Hi there,

Is there any method of converting hex number into binary number?

For example, if I have 000d, then I need to have,

0000000000000000000000000001101, that is 32 bit binary.

Thank you so much!
 
Sure:
Code:
my $hex_string = '000D';
my $binary_string = sprintf "%032b", hex( $hex_string );
 
Do you need it as a text form of the binary number or 2 bytes that represent the value (as in a zero byte and a carriage return)?


Trojan.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top