Here's a way to do it which utilises the power of Perl's arbitrary data structures. Anything you don't understand just ask :)
use strict; use warnings; use Data::Dumper; my @AoA = ( ['tony','skill','old'], ['tony','skill','new'], ['tony','skill1','old'], ['tony','skill1','new'], ['martin','skill','old'], ['martin','skill','new'], ['martin','skill1','old'], ); my (@names,%hash); for my $ary (@AoA) { my ($name,$stage_name,$type) = @$ary; push(@names,$name) unless $hash{$name}; push(@{ $hash{$name}{'stages'} },$stage_name) unless $hash{$name}{$stage_name}; $hash{$name}{$stage_name}{$type}++; } # to see the %hash data structure: print Dumper (\%hash); print qq|<table style="width:300px"> <tr><th>Name</th><th>Stage</th><th>Old</th><th>New</th></tr>\n|; for my $name (@names) { my $print_name = $name; my $stages = $hash{$name}{'stages'}; for my $stage_name (@$stages) { my $stage = $hash{$name}{$stage_name}; $stage->{'old'} = ($stage->{'old'} ? 'True' : 'False'); $stage->{'new'} = ($stage->{'new'} ? 'True' : 'False'); print qq|<tr> <td>$print_name</td> <td>$stage_name</td> <td>$stage->{'old'}</td> <td>$stage->{'new'}</td> </tr>\n|; $print_name = ''; } } print qq|</table>|;

Output (border added for clarity):

NameStageOldNew
tony skill True True
skill1 True True
martin skill True True
skill1 True False

In reply to Re: Filling Table in a HTML file using perl by tangent
in thread Filling Table in a HTML file using perl by farha89

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.