#!/usr/bin/perl -w use strict; my %kids=map { split } ; print "Father of $_ is $kids{$_}\n" for @ARGV; __DATA__ 1045316394 1045316144 1045316407 1045316394 1045316419 1045316407 1045316438 1045316419 1045316469 1045316394 1045316492 1045316407 1045316505 1045316492 #### $ perl fatherson.pl 1045316419 1045316492 Father of 1045316419 is 1045316407 Father of 1045316492 is 1045316407 #### sub print_lineage { my ($x) = @_; my @p; while (exists $kids{$x}) { $x = $kids{$x}; push @p,$x; } if (@p) { local ($") = ", "; print "Lineage of $_[0] is @p\n"; } else { print "Lineage of $_[0] is unknown\n"; } } print_lineage $_ for @ARGV; #### $ perl fatherson.pl 1045316419 1045316469 Lineage of 1045316419 is 1045316407, 1045316394, 1045316144 Lineage of 1045316469 is 1045316394, 1045316144 #### --- print map { my ($m)=1<