Jaccard distance implementation in perl