in reply to Re: Compare each array element to the rest, sequentially
in thread Compare each array element to the rest, sequentially
Are you sure ?. Try
#!/usr/bin/perl use strict; use Text::Levenshtein qw(distance); my $file = $ARGV[0]; open IN, '<',$file or die "$!"; chomp(my @all_IDS=<IN>); close IN; for (0..$#all_IDS){ my $id = shift @all_IDS; my @ld = distance ($id, @all_IDS); print join "\t",$id,@all_IDS,@ld,"\n"; push @all_IDS,$id; } __DATA__ A BB CCC DDDD
Result A BB CCC DDDD 2 3 4 BB CCC DDDD A 3 4 2 CCC DDDD A BB 4 3 3 DDDD A BB CCC 4 4 4poj
|
|---|