Data in a Table using Cgi.pm and perl ( approching a deadline)

Sorry  if the question is very trivial ..but please bare with me ( closing on a deadline..I hope u understand).
I tried a lot but my head seems to have given up .( I guess the nerves...I left this for the last )



I have got the functionality going but th presentation is not resulting in what I intend to.
I am using the CGI.pm module with Perl

I intend something like this..display the UserName and a string (MD5 algor) one beside the other
preferrable in a table


UserName1      yututiu67jhkjkjkjkkj
UserName2       jkjkjkkjkj5555555555


What I get is

UserName1
UserName2

yututiu67jhkjkjkjkkj
jkjkjkkjkj5555555555

The code( faulty) code that gets the above is this where the hashes have the values .

####################################################################################
print $page->start_Tr();
   print $page->start_td();
         print $page->start_table({-border=>2});
                for($i=0;$i<@user_sysuids;$i++){  # Iterates through the Number Of users

                        $page->start_Tr();
                       
                        print $page->start_td($user_names{$user_sysuids[$i]});  # The user Name
                        $page->end_td();
                   
                        print $page->start_td($user_keys{$user_sysuids[$i]});     # The Key
                     
                        $page->end_td();
                        $page->end_td();
                        $page->end_Tr();

                }
           print $page->end_table();

          print $page->end_td();
          $page->end_Tr();

###########################################################################################

Thanks for your time...
micro_learnerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

wilsoneCommented:
You are inconsistent with your use of end_td and start_td methods (etc).  This does not look like standard perl CGI methods, but I think you forgot some print statements.  Try this:

print $page->start_Tr();
   print $page->start_td();
         print $page->start_table({-border=>2});
                for($i=0;$i<@user_sysuids;$i++){  # Iterates through the Number Of users

                        print $page->start_Tr();
                       
                        print $page->start_td($user_names{$user_sysuids[$i]});  # The user Name
                        print $page->end_td();
                   
                        print $page->start_td($user_keys{$user_sysuids[$i]});     # The Key
                     
                        print $page->end_td();
                        print $page->end_td();
                        print $page->end_Tr();

                }
           print $page->end_table();

          print $page->end_td();
          print $page->end_Tr();
0
wilsoneCommented:
By the way, paste the resulting HTML if the above does not work.
0
wilsoneCommented:
Correction: This is just a different way of using the CGI module than I am accustomed to.
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

micro_learnerAuthor Commented:
Hi "wilsone" not having the "print" satatemsnts was a blatant error...but it still does not work with it.

I think I am placing the td and Tr combinations wrong ..I need to get the UserName on the  left and the key on the Right.

I appreciate your effort and time.Thanks

I am still getting

UserName1
UserName2

yututiu67jhkjkjkjkkj
jkjkjkkjkj5555555555

Instad of
UserName1     yututiu67jhkjkjkjkkj
UserName2       jkjkjkkjkj5555555555
0
wilsoneCommented:
Try this:

my $users;
for($i=0;$i<@user_sysuids;$i++){  # Iterates through the Number Of users
    $users = Tr(td($user_names{$user_sysuids[$i]}).td($user_keys{$user_sysuids[$i]}));
}
print table({-border=>2},$users);

Please post the html if this doesnt work.
0
wilsoneCommented:
Argh, that should be
    $users .= Tr(td($user_names{$user_sysuids[$i]}).td($user_keys{$user_sysuids[$i]}));

Need more coffee
0
TintinCommented:
I personally don't like using the CGI module for generating HTML.  I think it is clearer and easier to do it yourself or to use one of the templating modules.

I'd do something like:

print qq[<table border="2">\n];

foreach my $uid (@user_sysuids) {
   print qq[<tr><td>$user_names{$uid}</td><td>$user_keys{$uid}</td></tr>\n];
}

print "</table>\n";
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
wilsoneCommented:
Thats funny TinTin.  The CGI module is awesome.  Which templating modules are you referring to?
0
TintinCommented:
What do you find funny?  The idea that a CGI module should have a whole bunch of HTML functions in it?  One of the critisms of the CGI module was that it tried to do too much.  At least the later versions are more modular now.

For templating see:

http://perl.apache.org/docs/tutorials/tmpl/comparison/comparison.html

0
ahoffmannCommented:
print $page->start_table({-border=>2}),$page->Tr([$page->td([$user_names{$user_sysuids[$i]},$user_names{$user_keys[$i]}])]),$page->end_table;
0
wilsoneCommented:
ahoffman, I think we need all of the users in one table, not a table per user.  Add a loop.
0
ahoffmannCommented:
should not be a problem ta add a simple loop here ;-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.