$longest = soundex of longer string $shortest = soundex of shorter string if ($longest =~ /$shortest/) { ... }