This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# returns longest common prefix of a list of strings | |
sub lcp | |
{ | |
my $match = shift; | |
substr($match, (($match ^ $_) =~ /^\0*/, $+[0])) = '' for @_; | |
$match; | |
} |