|Perl Monk, Perl Meditation|
Handling Hex data with Dynamic unpackby PerlJedi (Novice)
|on Jul 05, 2012 at 08:51 UTC||Need Help??|
PerlJedi has asked for the
wisdom of the Perl Monks concerning the following question:
Hi Monks, I have a binary file with the headder content (in HEX) as below (one single line).
This data should be unpacked to populate the following structure.
Here is what I have been trying...
No doubt, I can decode the binary file this way. But here is what I prefer:
1. I need to convert the $noOfBSCs to Decimal, and then use it in a loop and then decode the data for the rest of the BSCs. Same would be followed for the Cells also.
> Is there a way that I can work without converting the read hex value in loops?
2. I do see that there is dynamic unpack possible also. But then I could not understand.
Since performance is a criteria, I dont want to code with C kind of logic. Please let me know as to how it can be done better in perl. Thanks in advance, PerlJedi