in reply to Methodology for matching in hashes
In your example, the canonical() sub would maybe replace hyphens in last names by spaces, and eliminate the last initial. The sub doesn't need to return just one cannonical form either, it can return an array of them for different types of matches.
Once you've done that the rest is fairly strightforward.
Hope this serves to get you started. Happy matching.while ($name = shift @inp_names) { for $canon ((canonical($name))) { #extra parens force list # add $name to an anon array, stored under the $canon key push @{$possible_matches{$canon}}, $name; } } for $canon (keys %possible_matches) { print "matches under $canon= ", join(',', @{$possible_matches{$canon}}) "\n"; } # for illustration. untested
|
|---|