develooper Front page | perl.perlfaq.workers | Postings from January 2005

perlfaq4: How do I find the soundex value of a string?

Thread Next
January 31, 2005 08:23
perlfaq4: How do I find the soundex value of a string?
Message ID:
* I started modifiying this answer because it's not Knuth's
algorithm.  I thought this was odd, but Knuth credits Odell
and Russell in "Sorting and Searching".

* I've run into several answers that seem to say "You don't really
want to do that" without any idea why someone is asking the question,
then giving a half-hearted explanation of what they don't want to

* I shortened the answer to simply point out the two modules that
the answer recommends. If someone wants to use Text::Soundex, they
are going to see how it works when they reads its documentation or
sees its output.

=head2 How do I find the soundex value of a string?
-Use the standard Text::Soundex module distributed with Perl.
-Before you do so, you may want to determine whether `soundex' is in
-fact what you think it is.  Knuth's soundex algorithm compresses words
-into a small space, and so it does not necessarily distinguish between
-two words which you might want to appear separately.  For example, the
-last names `Knuth' and `Kant' are both mapped to the soundex code K530.
-If Text::Soundex does not do what you are looking for, you might want
-to consider the String::Approx module available at CPAN.
+(contributed by brian d foy)
+You can use the Text::Soundex module. If you want to do fuzzy or close
+matching, you might also try the String::Approx module.
 =head2 How can I expand variables in text strings?

brian d foy,

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About