Actually, now you put it that way, I'm wrong. It could work and would be useful. It would be a departure from the norm of converting numerics to and from their binary representation.
There are some issues as to what should happen if you specified pack 'Y4', 100000; or pack 'Y4', 32.0 but actually that perhaps suggests a way around the lack of remaining letters that also has an existing precedent.
To skip a complex structure--say consisting of 2 shorts and float--the syntax is X[vvf], meaning skip enough bytes to cover 2 shorts and a float. Ie. 2+2+4 = 8 bytes.
To get your hexified numeric, the syntax could be pack 'H[v]', 32, meaning treat the number as a a 16-bit int and hexify it; thereby producing your 4 bytes of output.
The nice thing is that this then extends naturally to pack 'H[V]', 32; to produce 8-bytes of hex. And pack 'H[Q]', 123456789012345; and even pack 'H[f]', 1234.56e78; and so on.
And once that is accepted, this further extends to the other bain of pack/unpack; binary. With 'B[v] b[V} B[d]' etc. And a quick peruse of the docs suggest that 'O' isn't currently used, so maybe 'O[v] O[Q]' might be useful also.
Now all you've got to do is: knock up the patch; get it by p5p; and wait for it to make it into a build :)
In reply to Re^7: Using pack to evaluate text strings as hexadecimal values
by BrowserUk
in thread Using pack to evaluate text strings as hexadecimal values
by davis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |