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.