http://qs321.pair.com?node_id=678641

stevee has asked for the wisdom of the Perl Monks concerning the following question:

Hi Venerable Monks, I am struggling with a corrupt zip archive (another story really!) but to help me in wading through the analysis I have written the following code:
open (FILE, "< i:\\lenova_2008-03-28.zip"); open (OUT, "> i:\\fullhexdump.txt"); binmode(FILE); $count=0; while (<FILE>) { $count++; read(FILE, $buf, 1); $byte = unpack "H*", $buf; print "$byte"; print OUT "$byte "; } close FILE; close OUT; print "\n\n$count\n\n";
Now the zip archive is 5,914,271KB big, but running the above the count only gets to 22,780,549 bytes (giving a text output file of length 66,740KB). Obviously I am not reading the whole file in, but I can not see why. Does any Learned Brother or Sister have any idea?
Thanks
Stevee