Hi, I'm not sure I've understand what are the datas (Is "room" the data $building ?). But, I hope the code below will help you. (I am sure this code can be improved). This code use CGI and the output is:
ecserv1 ecmain
ecmain109 :: HP LaserJet 4050 :: Level I Support
ecmain144 :: HP LaserJet 4050TN :: Level I Support
ecmain147 :: HP LaserJet 8000 :: Level I Support
ecmain159 :: HP LaserJet 4MQ :: Level I Support

ecserv2 ecmain
ecmain145 :: Lexmark 800 :: No Support
ecmain158 :: HP LaserJet 4050N :: Level I Support

ecserv3 Gateway
ecgw110cp :: Tektronix 850 :: Level I Support
ecgw116 :: HP LaserJet 4050N :: Level I Support

none ecmain
ecmain112 :: Epson 1500 :: Level II Support
ecmain152 :: HP LaserJet II :: No Support

Code
#!/usr/bin/perl use CGI qw(:standard); use strict; my (@tab,@list_printer,@list_server); my (%printer_info,%server_info,%location_server); my $html=new CGI; my ($name, $building, $type, $server, $support); my ($value,$prev,$name_server,$name_printer); ##### array with the datas for testing ############ $tab[0]="ecmain109:ecmain:HP LaserJet 4050:ecserv1:Level I Support"; $tab[1]="ecmain112:ecmain:Epson 1500:none:Level II Support"; $tab[2]="ecmain144:ecmain:HP LaserJet 4050TN:ecserv1:Level I Support"; $tab[3]="ecmain145:ecmain:Lexmark 800:ecserv2:No Support"; $tab[4]="ecmain147:ecmain:HP LaserJet 8000:ecserv1:Level I Support"; $tab[5]="ecmain152:ecmain:HP LaserJet II:none:No Support"; $tab[6]="ecmain158:ecmain:HP LaserJet 4050N:ecserv2:Level I Support"; $tab[7]="ecmain159:ecmain:HP LaserJet 4MQ:ecserv1:Level I Support"; $tab[8]="ecgw110cp:Gateway:Tektronix 850:ecserv3:Level I Support"; $tab[9]="ecgw116:Gateway:HP LaserJet 4050N:ecserv3:Level I Support"; #################################################### print $html->header, $html->start_html; foreach $value(@tab) { ($name, $building, $type, $server, $support) = split ":",$value; $printer_info{$name}=$name." :: ". $type." :: ".$support; $server_info{$name}=$server; $location_server{$server}=$building; push (@list_printer,$name); push (@list_server,$server); } ###### sorting and removing duplicatas ############# @list_server=sort (@list_server); $prev="not equal"; @list_server=grep($_ ne $prev && ($prev=$_),@list_server); @list_printer=sort (@list_printer); $prev="not equal"; @list_printer=grep($_ ne $prev && ($prev=$_),@list_printer); ##################################################### foreach $name_server (@list_server) { print $html->start_table({-border=>'3'}), $html->Tr( td("$name_server"), td("$location_server{$name_server}") ); print $html->start_Tr, $html->start_td({-colspan=>'2'}); foreach $name_printer (@list_printer) { if ($server_info{$name_printer} eq $name_server) { print "$printer_info{$name_printer}", $html->br; } } print $html->end_td, $html->end_Tr, $html->end_table, $html->br; } print $html->end_html;

In reply to Re: CGI-Output Problems by tbo
in thread CGI-Output Problems by psychoto

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.