J
John Ramsden
I need to extract a couple of ASCII fields from a string of fixed-length
fields, let's say 'ABCxPQxxUVW' in which I'm not interested in characters
in positions indicated by 'x'. This can easily be done by the code line:
($a, $junk1, $p, $junk2, $u) = unpack "A3 A A2 A2 A3", $string;
But I was wondering if there is an unpack() spec one could use in the
control string to skip the junk fields and not have to extract them,
thus making the code slightly shorter.
I have tried reading the unpack and pack perldoc schpiel, but can't see
any obvious solution.
Cheers
John R Ramsden ([email protected])
fields, let's say 'ABCxPQxxUVW' in which I'm not interested in characters
in positions indicated by 'x'. This can easily be done by the code line:
($a, $junk1, $p, $junk2, $u) = unpack "A3 A A2 A2 A3", $string;
But I was wondering if there is an unpack() spec one could use in the
control string to skip the junk fields and not have to extract them,
thus making the code slightly shorter.
I have tried reading the unpack and pack perldoc schpiel, but can't see
any obvious solution.
Cheers
John R Ramsden ([email protected])