beginner171 has asked for the wisdom of the Perl Monks concerning the following question:

hi, i've never used perl before, but i need to program a simple database search engine. the database is for now simply a file full of documents, the user will type in a keyword and i want to display the most relevant hits. does anyone have any tips as to how to go about doing this? thanks.

Replies are listed 'Best First'.
Re: just starting!
by cog (Parson) on Mar 29, 2005 at 13:58 UTC
    does anyone have any tips as to how to go about doing this?

    Yes, I do have some tips!

    You should start by separating what you want to do... for instance:

    • Create a database
    • Access a database from Perl
    • Implement a search mechanism in the interface
    • etc...

    And then you should think about each of these issues at a time (but never forgetting the whole problem).

    And then, as you have questions, you can post them here. The difference from now is that you'll have more concrete questions...

Re: just starting!
by g0n (Priest) on Mar 29, 2005 at 14:06 UTC
    Your best starting point would probably be to work out the process you have to follow, and start coding it.

    You could start by looking at DBI. Then when you run into problems, read this guide to posting a question.

    As per cogs posting, step one is probably to write a simple script that reads data from a database.

    Update: I sort of assumed that you already have a database you want to interact with - but cog is quite right, step one is to get your database set up, then try and read from it using perl!

    g0n, backpropagated monk
      Er... step one was "Create a database", not reading "data from a database" :-)

      But anyway, what I wanted to say was: you have to choose a database (or perhaps not, as ghenry says).

      And there's plenty of databases to choose from...

Re: just starting!
by ghenry (Vicar) on Mar 29, 2005 at 14:04 UTC

    Does it have to be a database?

    You could use http://swish-e.org/, it has perl modules and an integrated web interface.

    Walking the road to enlightenment... I found a penguin and a camel on the way..... Fancy a yourname@perl.me.uk? Just ask!!!
Re: just starting!
by ambs (Pilgrim) on Mar 29, 2005 at 13:52 UTC
    This can sound rude, but that is not the idea. You want to learn Perl and solve your problem, or just solve your problem?

    Alberto Simões

Re: just starting!
by cbrandtbuffalo (Deacon) on Mar 29, 2005 at 17:03 UTC
    If your current 'database' is truly just a file, then Perl is an excellent tool for allowing someone to search the file. If you want to get started there, you will find some good resources for working with files in the Tutorials.

    If you need more details, you might also want to post the type of system you're trying to run this on (Unix, Windows, etc.)

A reply falls below the community's threshold of quality. You may see it by logging in.