in reply to Unpacking fixed length records
$str = "\004ABC\003DE\002F";
$fmt = "(C X /a)*";
@z = unpack($fmt,$str);
foreach $z (@z) {
print "'", join("', '", map {ord} split(//,$z)),"'\n";
}
returns
'4', '65', '66', '67' '3', '68', '69' '2', '70'So you could probably get your desired result with "(n XX /a)*" ?
--
I'm a pessimist about probabilities; I'm an optimist about possibilities.
Lewis Mumford
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Unpacking fixed length records
by diotalevi (Canon) on Oct 07, 2002 at 00:15 UTC | |
by shenme (Priest) on Oct 07, 2002 at 04:43 UTC | |
by diotalevi (Canon) on Oct 07, 2002 at 14:29 UTC |