| |||||||||||
| |||||||||||
Perl - Bit Manipulation Posted by dharshana.ve (dharshana.ve), 13 November 2006 Hi all,I am working on the code below.... use strict; use warnings; my $hex = "43"; my $binary = unpack 'B*', pack 'H*', $hex; print "$binary\n\n"; my @fields = unpack 'A2A2A4', $binary; my $i; printf "%-4s => %s\n", $fields[$i++], $_ foreach qw/Ext TypeofNumber NumberingPlan/; **OUTPUT** 01000011 01 => Ext 00 => TypeofNumber 0011 => NumberingPlan But, now i have a hash(associative array), %TypeofNumber = ( 00 => Integer, 01 => Floating, 10 => Char, 11 => Double ); Using this hash, the type of number has to be specified in the output. As shown here: 01 => Ext TypeofNumber 00 => Integer 0011 => NumberingPlan I am unable to get the desired output? Thanks and regards, Dharshana Posted by admin (Graham Ellis), 15 November 2006 Sorry - I don't understand the questionThis page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
|
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho |