Failed to link folders with its *.html extension files in perl? : Here is my code and folder.

Folder structure:

    Mus
    |-- Mus.config
    |-- Mus.html
    `-- Mus_Digital
        |-- Digi_Verification
        |   |-- Digi_Verification.config
        |   |-- Digital_Verification.html
        |   `-- rev1
        |       |-- _projects_Mus_Mus_Digi_Digi_Verification_rev1.config
        |       `-- _projects_Mus_Mus_Digi_Digi_Verification_rev1.html
        |-- Mus_Digital.config
        `-- Mus_Digital.html

The above is my obtained directory struture from $output_dir.Here i my code what i really tried is conversion of .config to .html format.

Now the problem is if i click Mus folder it should open Mus.html.If i click Mus_Digital it should open Mus_Digital.html and so on.The same procedure should apply for all folders and sub folders and also for href links.

Now in my code the href links are not pointing to its *.html(here * denotes anyname before .html).Help to point directly to its html file when the folder is clicked.

My code:

    print"Converting the .config files to .html files at destination location \n";
    ##HTML CONVERSION##
    my @files = File::Find::Rule->file
                                ->name('*.config')
                                ->prune
                                ->in($output_dir);                                                      
    foreach my $file (@files) 
    {
        my ($name, $root, $ext) = $file =~ m|(.*)/(.*)\.(.*)|;   
        my $outfile = "$name/$root.html";
        open my $fh_out, '>', $outfile or die "Can't open $outfile: $!","\n";
        my $head = "
    <!doctype html>
    <html lang=\"en\"> 
    <head> <meta charset=\"utf-8\"> <title>DCMS_CHECKLIST</title><tr><td></td></tr> </head> 
    <body>
    <table>
    <th>SL.NO</th><th>CHECKLIST ITEM</th><th>VALUE</th><th>COMMENTS</th><th>CONFIRMATION</th>
    <style>
    .bold {
      font-weight: bold;
    }
    .bold td
    {
    border: 0px;
    }
    table, th, td {
        border: 1px solid black;
    }
    </style>";
        print $fh_out $head ;   # write the header
        open my $fh, '<', $file or die "Can't open $file: $!";
        while (my $line=<$fh>) {
        chomp $line;
        for($line)
        {    
        s/\&//g;
        #s/[\\\_\@\_]//g;
        s/COMMENT//g;
        }
        my @data = split /:/, $line;
        my $class = $data[0] ? 'normal' : 'bold';  
        print $fh_out qq[<tr class="$class">];
    
    #   my $href="http://iad.sd.aog.com/cps/dev/kb/cms/cms_prects/";
        my $check=0;
        my $dolink=$data[0] !~ m/[\=\%]/;
        for my $word(@data){ 
        $check++;
        print $fh_out '<td>';
        if($check==1 && $dolink ) {
             print $fh_out '<a href=".">'.$word.'</a>';   
             }
          else { print $fh_out $word;} 
          print $fh_out '</td>';
          }
          }      
    }

Here $href variable is the default output directory location.All the output directories will be under this path.

