Query in pack and unpack functions

2007-05-03 Thread Dharshana Eswaran
Hi All, My aim is to supply a hexadecimal value and print its binary value. I have written a small piece of code for the same: $input = 23; #any decimal value $hex1 = sprintf ("%x",$input); $binary = unpack 'B*', pack 'H*', $hex1; @fields1 = unpack 'A4A4', $binary; print "$fields1[1] $fie

Re: Query in pack and unpack functions

2007-05-03 Thread Dr.Ruud
"Dharshana Eswaran" schreef: > $input = 23; #any decimal value > $hex1 = sprintf ("%x",$input); > $binary = unpack 'B*', pack 'H*', $hex1; > @fields1 = unpack 'A4A4', $binary; > print "$fields1[1] $fields1[0]";# i need to print the Lower > Nibble first and then the Higher nibble > > But

Re: Query in pack and unpack functions

2007-05-03 Thread Dharshana Eswaran
Thank you Dr.Ruud. It solved my problem. :-) Thanks and Regards, Dharshana On 5/3/07, Dr.Ruud <[EMAIL PROTECTED]> wrote: "Dharshana Eswaran" schreef: > $input = 23; #any decimal value > $hex1 = sprintf ("%x",$input); > $binary = unpack 'B*', pack 'H*', $hex1; > @fields1 = unpack 'A4A4', $

Re: Query in pack and unpack functions

2007-05-03 Thread John W. Krahn
Dharshana Eswaran wrote: > Hi All, Hello, > My aim is to supply a hexadecimal value and print its binary value. > > I have written a small piece of code for the same: > > $input = 23; #any decimal value > $hex1 = sprintf ("%x",$input); > $binary = unpack 'B*', pack 'H*', $hex1; > @fields1 =