|
|
| Just another Perl shrine | |
| PerlMonks |
Re^5: Using pack to evaluate text strings as hexadecimal valuesby BrowserUk (Pope) |
| on Mar 22, 2011 at 12:22 UTC ( #894781=note: print w/ replies, xml ) | Need Help?? |
|
It doesn't give me a single format string that I can use to convert back and forth between "records" and "fields". The "problem" is that you cannot have a single conversion that produces binary numeric data for internal math use, and also produces asciified hex string for display purposes. It's the same as asking for a single printf format that will display an number as decimal and hex. It cannot be done. The solution is to have two templates: 1 for internal packing and unpacking:
And another for unpack a record for display purposes:
There is simply no way to implement a single template that would server both purposes. Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||