TIMTOWTDI!
use strict; use warnings; use Spreadsheet::HTML qw(generate); my @data = map { chomp; s/(?:COMMENT|[&\\_@])//g; [split /:/] } <DATA +>; my @class = map { map $_ ? 'norm' : 'bold', splice @$_, 0, 1 } @data; my @frag = map { splice @$_, 2, 1 } @data; print generate( data => \@data, matrix => 1, indent => ' ', tr => { class => \@class }, -c2 => sub { sprintf '<a href="#%s">%s</a>', shift(@frag), shift } ); __DATA__ 0:A:B:frag1:name1 1:C:D:frag2:name2 0:E:F:fr&ag3:naCOMMENTme3 1:G:H:fr\ag4:_name4 0:I:J:fr@ag5:name5
Output:
<table> <tr class="bold"> <td>A</td> <td>B</td> <td><a href="#frag1">name1</a></td> </tr> <tr class="norm"> <td>C</td> <td>D</td> <td><a href="#frag2">name2</a></td> </tr> <tr class="bold"> <td>E</td> <td>F</td> <td><a href="#frag3">name3</a></td> </tr> <tr class="norm"> <td>G</td> <td>H</td> <td><a href="#frag4">name4</a></td> </tr> <tr class="bold"> <td>I</td> <td>J</td> <td><a href="#frag5">name5</a></td> </tr> </table>

In reply to Re^2: How to add hyperlink for every table data using perl? by Anonymous Monk
in thread How to add hyperlink for every table data using perl? by finddata

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.