in reply to Re^6: Index a file with pack for fast access
in thread Index a file with pack for fast access

I've uploaded the three files I'm using to gist

Why there and not here?

But, this is your error:

open(IN, $oneper) or die "Can't open file $oneper for reading: $!\n"; open(INDEX, ">:raw","$file.idx") or die "Can't open $file.idx for read +/write: $!\n"; syswrite INDEX, pack('N',0),4; while (<IN>) { syswrite INDEX, pack('N', tell INDEX), 4; ##.................................^^^^^ } close INDEX;

You are indexing your index file instead of your datafile.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?

Replies are listed 'Best First'.
Re^8: Index a file with pack for fast access
by Ineffectual (Scribe) on Dec 21, 2011 at 22:30 UTC
    Thanks so much for looking at that. :) It works great now. I um... can never figure out how to link stuff on here, so I figured gist was as good.
      I um... can never figure out how to link stuff on here, so I figured gist was as good.

      Its generally preferred that code be posted here (in <code> ... </code> brackets), because offsite links expire and go away, whereas coded posted here will stay around at least as long as the site does. Thus anyone reading this thread 10 years from now will be able to make sense of the discussion.

      As is, this thread won't make much sense once gist goes away, as things on the internet have a habit of doing.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      The start of some sanity?