Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^6: Index a file with pack for fast access

by Ineffectual (Scribe)
on Dec 21, 2011 at 18:56 UTC ( [id://944677]=note: print w/replies, xml ) Need Help??


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

I was thinking it would help to recode it using something else because it seems like what's happening is that the entire line isn't fitting in 4 bytes. Maybe it's the tabs?

I've uploaded the three files I'm using to gist
  • Comment on Re^6: Index a file with pack for fast access

Replies are listed 'Best First'.
Re^7: Index a file with pack for fast access
by BrowserUk (Patriarch) on Dec 21, 2011 at 19:32 UTC
    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?

      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?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://944677]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-04-19 08:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found