in reply to Index a file with pack for fast access
open(INDEX, "+>$file.idx") or die "Can't open $file.idx for read/write: $!\n";</c>
If you are using Windows -- and it will do no harm even if you are not-- one thing you should be doing is binmodeing your index file.
pack 'N' can produce values containing bytes that look like various control characters -- \r, \n, ^Z etc. -- that will cause Windows to do nasty things to your index file unless you tell it that the file will contain binary data.
|
|---|