Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Searching text files

by nferraz (Monk)
on Sep 14, 2006 at 18:57 UTC ( [id://572976]=note: print w/replies, xml ) Need Help??


in reply to Searching text files

My first suggestion is that you do not start an application by creating the GUI. Start with a simple command-line script which will solve your problem, and make sure it works; they you can play with UI.

Now, the fastest solution is, IMO, the use of CDB_File. It will return data in a fraction of millisecond.

It usually takes two scripts: the first one is used to create a CDB file from your data:

use CDB_File; $t = new CDB_File ('t.cdb', "t.$$") or die ...; $t->insert('key', 'value'); $t->finish;

The second script simply ties the CDB to a hash and look for a key:

use CDB_File; tie %data, 'CDB_File', $filename or die "$0: can't tie to $filename: $!\n"; if (defined $data{}) { # ... }

That's it! The fact that it doesn't require a relational database will make it easier to set up your application. Think about that!

Finally, take a look at Tie::File::AsHash -- it can be usefull.

Log In?
Username:
Password:

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

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

    No recent polls found