in reply to Two Column Output with Text::Autoformat
Maybe something like this:
use strict; use warnings; use Text::Autoformat; my $text = do { local $/; <>; }; my $formatted = autoformat $text, { left => 1, right => 38, justify => 'full', all => 1 }; my @lines = split /\n/, $formatted; if ( @lines > 50 ) { my $lines = int( ( @lines + 1 ) / 2 ); $formatted = ''; for ( 0 .. $lines - 1 ) { $formatted .= sprintf "%-38s %-38s\n", $lines[$_], ( $lines[ $_ + $lines ] ? $lines[ $_ + $lines ] : '' ); } } print $formatted;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Two Column Output with Text::Autoformat
by bohrme (Scribe) on Oct 07, 2009 at 20:50 UTC |