[Chicago-talk] Parsing a Hex file

Jay Strauss me at heyjay.com
Fri Jan 19 09:40:51 PST 2007


> Perl has a tool just for handling this sort of thing, in the "pack" function.
> See perldoc -f pack, perldoc -f unpack, and perldoc perlpacktut, specifically
> the bits about the "/" character in pack templates, which allows for
> length-prefixed fields.
>
> Andrew

Thanks Andrew, I read the perldoc perlpacktut, and followed it for a
while, but got sort of lost at the end (not having ever worked with
this type of data).

In my case I don't know (ahead of time) how many fields there are.  I
need to read until the end of the file.  Do I need to loop, keeping
track of where I am in the file, or is there some way in unpack and
"/" it will spit it out to an array without predefining the number of
fields?

Thanks
Jay


More information about the Chicago-talk mailing list