use strict; use Gedcom; die 'ERROR: No file specified' unless $ARGV[0]; die 'ERROR: File not found' unless -e $ARGV[0]; die 'ERROR: No name specified' unless $ARGV[1]; my $ged = Gedcom->new(gedcom_file => $ARGV[0], read_only => 1) or die "ERROR: $!"; die 'ERROR: No matches found.' unless my $i = $ged->get_individual($ARGV[1]); descendency($i); sub descendency { my $i = shift; my $gen = shift || 1; print "\t" x ($gen - 1), "$gen ", info($i), "\n"; foreach my $s ($i->spouse) { print "\t" x ($gen - 1), '+ ', info($s), "\n"; descendency($_, $gen + 1) for ($s->children); } } sub info { my $i = shift; return '[' . $i->xref . '] ' . names($i) . ' ' . dates($i); } sub dates { my $i = shift; $i->normalise_dates("%B %E, %Y"); my $r = '(' . join(' - ', ($i->get_value('birth date'), $i->get_value('death date'))) . ')'; return $r eq '()' ? '' : $r; } sub names { my $i = shift; return $i->given_names . ' ' . $i->surname; }