On 11/09/2006 07:04 AM, Dharshana Eswaran wrote:
Rajeev,
Actually, i get data in hex bytes from a log file. I have to parse them or
analyze them according to some predefined rules or values.
For eg: a hex byte of 0xa4 is converted to binary as 10100100
Now, i have a file in which the values are predefined. It looks like
0xa4 => 10100100
in that MSB 1 stands for some abc
then the following bits 01 stands for cdf
then the remaining bits 00100 stands for xyz
(0/1) | 2 bits | 5 bits
abc | System name | Other details
System name Other Details
00 ujj 00000
01 cdf 00001 etc....
10 bbg
11 gtt
In the above example, the text is just an eg and not the actual text.
I get those 8 bits as a whole as hex byte which i need to parse and diplay
them bitwise.
Hope this explains better.
Dharshana
Use the unpack function:
Start->Run->"perldoc -f pack"
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>