--- Why Tea <[EMAIL PROTECTED]> wrote: > I have a text file of acronyms of about 2MB, I would like to write > a > cgi script to allow users to query for any acronym in the text > file. > What is the best way of implementing it (i.e. taking the acronym as > a > key to search for the expanded text)? >
the most common way is to use a key/value based text db. you create the file like: # test.db afaik "as far as i know" ppl "people" asap "as soon as possible" .... then write a cgi script to do the query: use CGI; my $q = CGI->new; my $key = $q->param("key"); my $value = 'unknown'; open FD,"test.db" or die $!; while(<FD>) { next if (/^#/ || /^$/); chomp; my ($k,$v) = split; next unless $k eq $key; $value = $v; last; } close FD; print $q->header; print $value; __END__ (warn: didn't test it) Good luck! Best Regards, Jeff (joy) Peng ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/