Using that module, your table would be generated like so:
Or, if your data was likely to spill over multiple pages, you might prefer more sophisticated headers and footers:use Text::Reform; my @name = qw(foo foo2 foo3); my @last = qw(bar bar2 bar3); my @count = qw( 3 4 5 ); print form "--------------------------------------------------", "NAME LAST COUNT", "--------------------------------------------------", "[[[[[[[[[ [[[[[[[[[[[[[[[[[[ |||||", \@name, \@last, \@count;
Note in particular the use of a (conditional, nested) call to form within the footer of the main form.use Text::Reform; my @name = (qw(foo foo2 foo3)) x 20; my @last = (qw(bar bar2 bar3)) x 20; my @count = (qw( 3 4 5 )) x 20; print form { header => "--------------------------------------------------\n" . "NAME LAST COUNT\n" . "--------------------------------------------------", footer => sub { my ($pagenum, $lastpage) = @_; return "\n\n\nEND OF REPORT" if $lastpage; form "\n\n\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>", ".../".($_[0]+1); }, pagelen => 20, pagefeed => "\n\n".("_"x60)."\n\n", }, "[[[[[[[[[ [[[[[[[[[[[[[[[[[[ |||||", \@name, \@last, \@count;
The Perl 6 format syntax will be even more sophisticated than that provided by Text::Reform, since I'll be taking advantage of new features of Perl 6. For example, the named options that control headers/footers/etc won't need to be in hashes, and array arguments won't require an explicit backslash.
There will also be additional formatting modes and options, all of which will eventually be described in Exegesis 7.
In reply to Re: Re: Re: using format to align
by TheDamian
in thread using format to align
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |