Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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

by Ineffectual (Scribe)
on Dec 20, 2011 at 23:22 UTC ( [id://944496]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    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', tell INDEX), 4;
    }
    close INDEX;
    
  2. or download this
    open INDEX, "<:raw","$index" or die "Can't open $index for reading: $!
    +";
    my $len = -s( INDEX );
    ...
      my $line = <FILE>;
      print "found line $line\n";
    }
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2024-04-19 19:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found