How to link the folders from .html file contents using perl?

my @files = File::Find::Rule->file
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> 
<th>SL.NO</th><th>CHECKLIST ITEM</th><th>VALUE</th><th>COMMENTS</th><th>CONFIRMATION</th>
.bold {
  font-weight: bold;
.bold td
border: 0px;
table, th, td {
    border: 1px solid black;
    print $fh_out $head ;   # write the header
    open my $fh, '<', $file or die "Can't open $file: $!";
    while (my $line=<$fh>) {
    chomp $line;
   # s/[\\\_\@\_]//g;
    my @data = split /:/, $line;
    my $class = $data[0] ? 'normal' : 'bold';  
    print $fh_out qq[<tr class="$class">];
   my $href="";
    my $check=0;
    my $dolink=$data[0] !~ m/[\=\%]/;
    for my $word(@data){ 
    print $fh_out '<td>';
    if($check==1 && $dolink ) {
         print $fh_out '<a href="'.$href.'">'.$word.'</a>';   
      else { print $fh_out $word;} 
      print $fh_out '</td>';

In the above code my problem is with href linking.My folders will be in the above represents href directory.Under that folder there will be many folders.Each folders will have .html files.Those html files will have the contents with hyperlink.So now the hyperlinked contents inside the .html file and the folder names will be similar.My needed thing is if i click any of the contents inside the .html file and the href_link should open the matched named directory or from its sub directory location using perl and html.How can i fix the hyperlink.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.