#!/usr/bin/perl -w use strict; use warnings; my $taxId = [0-9]; my $taxId1 = $ARGV[0]; my $taxId2 = $ARGV[1]; my $C = getDistance ($common_node); print $C; sub getParent { my ($taxId) = @_; my @parent_list = ""; while ($taxId = $taxId1){ my $parent = `getz "[taxonomy:$taxId1]" -f pid`; chomp $parent; $parent =~ s/PARENT ID :/ /; $taxId1 = $parent; push @parent_list, $parent; # } return @parent_list; } sub getDistance { my ($common_node) = @_; my $id; my $count; do{ $id = getParent ($taxId); $count++; }until ($id eq $common_node); return $count; }