=pod Code submission from: Paul Schaap (schaappa@ozemail.com.au) fastFind 1.0.0 Release Notes WHY === A very,very fast way to do a search on a very large file. Achieved by presorting the file and making the length of each field the same. You can then use the awesomely quick sysseek and sysread Perl functions. INSTALLATION ============ ï Install MacPerl 5.1.4r4 or greater.(Thanx Matthias) And add Chris Nandors Sort Perl Module on the Mac, or, use Alpha or Word to sort the Index file. USAGE ===== 1) Drop a file with the structure :- 1. Name 2. Address 3. Suburb 4. Postal Code 5. Phone number delimited by pipe "|" onto 'generateIndex Droplet' (e.g. generateIndex Input). 2) Open and run fastFind.pl then maybe use it as a require in an application or cgi. CHANGES ======= V1.0.0 ï Well none really, first cut. CHEERS schaapp@ozemail.com.au - I Only read email once a fortnight, sorry. =cut #!/usr/bin/perl ##################################################################### # PROGRAM : generateIndex Droplet # BY : Paul Schaap # DATED : 05/01/1998 # PURPOSE : To generate an index file for fastFind ##################################################################### $|=1; print "Writing Index ....\n"; open(PI,">:indexFile") or die "Cannot open indexFile.\n"; while(<>){ $k++; chomp; @Detail = split(/\|/); $Name = $Detail[0]; $Address = $Detail[1]; $Suburb = $Detail[2]; $State = $Detail[3]; $Postal_Code = $Detail[4]; $Phone_Number = $Detail[5]; printf PI ("%10.10s" ,$Phone_Number); printf PI ("%-40.40s",$Name ); printf PI ("%-40.40s",$Address ); printf PI ("%-20.20s",$Suburb ); printf PI ("%-3.3s" ,$State ); printf PI ("%-8.8s" ,$Postal_Code ); print PI "\n"; } print "........Done\n"; close PI; MacPerl::SetFileInfo("ttxt", "TEXT", ":indexFile"); # I dont like this but it was the only way I could do it. # The numbers in the next print refer to the field sizes above. open(PC,">:indexCount") or die "Cannot open Phone.count.\n"; print PC "$k,10,40,40,20,3,8"; close PC; MacPerl::SetFileInfo("ttxt", "TEXT", ":indexCount"); print "$k row(s) written to Phone.index.\n"; print "PLEASE USE AN APPLICATION TO SORT index file (ALPHA is a goodun) or\n"; print "use Chris Nandor's File::Sort module.\n"; #########