Hello everyone,

I am currently writing a script to report on problematic entries in our company project management software's address list. I want to emit a a report in plain text, using Perl6::Form if possible. So far, it is mostly working, except for reporting entries with duplicate email addresses. While traversing the database, I gather duplicate email addresses in to a hash of lists, where the keys are the email adresses and the respective lists contain the names of the people who have that address listed.

I would like the output to look something like this:
+------------------------------------------------------------+
| fake_address1@example.com              John Doe            |
|                                        Jane Doe            |
|                                                            |
| fake_address2@example.com              John Doe            |
|                                        Jane Doe            |
...
Currently, I am calling form like this:
my %table = get_duplicates(); # More complicated, but you get the idea +. my @addresses = sort keys %table; my $report = form {bullet => '*'}, '+-----------------------------------------------------------+', '| {[[[[[[[[[[[[[[[[[[[[[[[[[[[} * {[[[[[[[[[[[[[[[[[[[[[} |', \@addresses, [map { $table{$_} @adresses], '| |', '+-----------------------------------------------------------+';

When I my script, however, the output looks more like this:

+-------------------------------------------------------+
| fake_address1@example.com           ARRAY(0x12345678) |
|                                                       |
| fake_address2@example.com           ARRAY(0x90abcdef) |
...
I do get what is happening here, but is there a way for Perl6::Form to format my data the way I want it to?
I could use a full-blown templating library instead of Perl6::Form, but I would really prefer not to.
Is my approach entirely mistaken or am I just missing a minor detail?
Thank you very much for any insights you might feel like sharing with me!


In reply to Formatting nested data structure in Perl6::Form by slothrop

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.