Organization of data in table form is a time-honored and useful method of data representation.
While columns of data are trivially generated by computer through formatted output, even simple tasks like keeping titles aligned with the data columns are not trivial, and the one-shot solutions one comes up with tend to be particularly hard to maintain.
Text::Table is a Perl module that allows you to create and maintain tables that adapt to alignment requirements as you use them.
SYNOPSIS
use Text::Table;
my $tb = Text::Table->new(
"Planet", "Radius\nkm", "Density\ng/cm^3"
);
$tb->load(
[ "Mercury", 2360, 3.7 ],
[ "Venus", 6110, 5.1 ],
[ "Earth", 6378, 5.52 ],
[ "Jupiter", 71030, 1.3 ],
);
print $tb;
This prints a table from the given title and data like this:
Planet Radius Density
km g/cm^3
Mercury 2360 3.7
Venus 6110 5.1
Earth 6378 5.52
Jupiter 71030 1.3
Note that two-line titles work, and that the planet names are aligned differently than the numbers.
Product's homepage
Requirements:
· Perl