Programming Perl

Programming PerlSearch this book
Previous: 7.2.52 SDBM_File - Tied Access to SDBM FilesChapter 7
The Standard Perl Library
Next: 7.2.54 SelectSaver - Save and Restore Selected Filehandle
 

7.2.53 Search::Dict - Search for Key in Dictionary File

use Search::Dict;
look *FILEHANDLE, $key, $dict, $fold;

The look() routine sets the file position in FILEHANDLE to be the first line greater than or equal (stringwise) to $key. It returns the new file position, or -1 if an error occurs.

If $dict is true, the search is in dictionary order (ignoring everything but word characters and whitespace). If $fold is true, then case is ignored. The file must be sorted into the appropriate order, using the -d and -f flags of UNIX sort(1), or the equivalent command on non-UNIX machines. Unpredictable results will otherwise ensue.


Previous: 7.2.52 SDBM_File - Tied Access to SDBM FilesProgramming PerlNext: 7.2.54 SelectSaver - Save and Restore Selected Filehandle
7.2.52 SDBM_File - Tied Access to SDBM FilesBook Index7.2.54 SelectSaver - Save and Restore Selected Filehandle