This is probably (well, certainly - probably) kicking in an open door, but a good book on stuff like this is our very own davorg's Data Munging with Perl. Among other things, it discusses the care and feeding of pack and unpack.
CU Robartes-
Comment on Re: data extraction from badly formated txt files