SPUG: Pretty-Printing Nested Hashes?

jerry gay jerry.gay at gmail.com
Mon Sep 19 16:59:13 PDT 2005

On 9/19/05, Michael Wallendahl <mwallend at spikus.com> wrote:
> Hello,
> I'm wondering if anyone has a suggestions on a good algorithm to
> 'pretty-print' a nested hash in tabular form?
> Take the following hash:
[snip perl example]
> Is there an easy way to print out the contents of %h in a tabular form
> so that the width of each column is set to the largest element?   Like
> this:
>     First     Last
>     --------- ------
>     Bob       Marley
>     Sue Ellen Smith
i believe the answer you're looking for can be found in Damian
Conway's Perl6::Form module. i'm sure you'll find the documentation
enlightening, especially the section entitled "Distributive field
widths," which appears just after halfway from the top of the


there's no reason to wait for Perl 6 when it's here already :)

More information about the spug-list mailing list