sub recover_index {
    my ($ddir) = @_;
    opendir DIR, $ddir or die "Fail to open directory: $!";
LOOP2: while($_ = readdir DIR) {
	   next if $_ !~ /\.dat$/;
           my $file= "$ddir/$_" ; 
           open MFILE, "<$file" or next; 
           while(<MFILE>) {
             if(/<!--X=([^\n]+)-->/) {
		my $str = $1;
		my @arr = split /\t/, $1;
		push @darr, [$arr[0], $str];
			
               next LOOP2;
              }
           }
           close MFILE;
     }
     my @drr2= sort { $a->[0] <=> $b->[0] } @darr;
     print join("\n", map {$_->[1]} @drr2), "\n";
}

recover_index($ARGV[0]||".");
