in reply to Re^3: Using pack to evaluate text strings as hexadecimal values
in thread Using pack to evaluate text strings as hexadecimal values
It doesn't give me a single format string that I can use to convert back and forth between "records" and "fields".
@fields = unpack($format, $record); $record = pack($format2, @fields);
(I actually use hash slices rather than arrays, but that's not germane here.) I don't mind having distinct formats. For all-alpha fields, I sometimes do
($format3 = $format) =~ s/A/a/g;
so I can generate a non-trimming unpack format from the default, a convenience, but not absolutely essential, since setting up the formats is a one-time thing, but conversion is a per-record thing.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Using pack to evaluate text strings as hexadecimal values
by BrowserUk (Patriarch) on Mar 22, 2011 at 12:22 UTC | |
by jpl (Monk) on Mar 22, 2011 at 13:22 UTC | |
by BrowserUk (Patriarch) on Mar 22, 2011 at 13:58 UTC |