astroboy has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I am trying to print three columns where the third column wraps. I'd like each of the rows to line up, but aren't having any joy. e.g.
use Text::Reform; @name = qw(Tom Dick Harry); @score = qw( 88 54 99); @Desc = ('A longish sentence', 'Another long sentence', 'last of the long sentences'); print form '-------------------------------------------', 'Name Score Desc', '-------------------------------------------', '[[[[[[[[[[[[[[ ||||| [[[[[[[[[[[[[[[[', \@name, \@score, \@Desc;
It gives:
-------------------------------------------
Name             Score     Desc
-------------------------------------------
Tom               88       A longish sente-
Dick              54       nce
Harry             99       Another long se-
                           ntence
                           last of the long
                           sentences
but what I'd like is
-------------------------------------------
Name             Score     Desc
-------------------------------------------
Tom               88       A longish sente-
                           nce
Dick              54       Another long se-
                           ntence
Harry             99       last of the long
                           sentences

Any ideas?

Replies are listed 'Best First'.
Re: Aligning rows in Text::Reform
by ctilmes (Vicar) on Oct 21, 2003 at 11:53 UTC
    use Text::Reform; @name = qw(Tom Dick Harry); @score = qw( 88 54 99); @Desc = ('A longish sentence', 'Another long sentence', 'last of the long sentences'); print form '-------------------------------------------', 'Name Score Desc', '-------------------------------------------'; for (my $i = 0; $i < @name; $i++) { print form '[[[[[[[[[[[[[[ ||||| [[[[[[[[[[[[[[[[', $name[$i], $score[$i], $Desc[$i]; }
      Thanks!