in reply to Re: How to add hyperlink for every table data using perl?
in thread How to add hyperlink for every table data using perl?

<a href="' .$href_to_what{$word} .'">'
can you explain this part

Content restored and code tags added by GrandFather

Replies are listed 'Best First'.
Re^3: How to add hyperlink for every table data using perl?
by huck (Prior) on Mar 09, 2017 at 06:51 UTC

    $href_to_what{$word} is a hash, indexed by every word where each value for a word contains the link for that word

    You need to edit that post and fix it so it displays right, i think you have square braces you dont want to be in there

      what is the purpose of (.) you added in front of every line ?
        what is the purpose of (.) you added in front of every line ?

        That's the string concatenation operator, see perlop. '<td><a href="' . $href_to_what{$word} . '">' . $word . '</a></td>' concatenates those five strings together into a single string. In this case it's the same as writing "<td><a href=\"$href_to_what{$word}\">$word</a></td>".

        text string concatenation

Re^3: How to add hyperlink for every table data using perl?
by finddata (Sexton) on Mar 09, 2017 at 06:50 UTC
    How can i hyperlink only the first column of the table using perl.The above code will hyperlink all contents of table data>

      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 $ct=0; for my $word(@data){ $ct++; print $fh_out '<td>'; if ($ct==1){ print $fh_out '<a href="' .$href_to_what{$word} .'">'; } print $fh_out $word; if ($ct==1){ print $fh_out '</a>'; } print $fh_out '</td>'; } print $fh_out "</tr>\n"; }
      Untested, YMMV

        I have few more doubts.i want to stop this process at some directory levels.Can i able to do? for example my tree struture:
        DCMS_DEMO |-- DCMS_DEMO.config |-- DCMS_DEMO.html |-- de_top | |-- Block_DV | | |-- Block_DV.config | | |-- Block_DV.html | | |-- rev1 | | | |-- rev1.config | | | `-- rev1.html | | `-- rev2 | | |-- rev2.config | | `-- rev2.html
        The above script conversion should be done until the following levels.Now my script imports the hyprlinks for all directory levels.How can i do it.Is it possible?
        |-- DCMS_DEMO.config |-- DCMS_DEMO.html |-- de_top | |-- Block_DV | | |-- Block_DV.config | | |-- Block_DV.html
        And also the a href links from directory to directory level. if i click any of contents from DCMS_DEMO.html it should link with Block_DV.html.Likewise for Block_DV.html.But the link attachements should stop at Block_DV directories.