in reply to Output an array of values in column format?
format is rather old school Perl and there are many many other ways to achieve what you want. One possibility is to concatenated fixed width strings to a line until it is long enough:
use strict; use warnings; my $policy = <<POLICY; To|that|end, I|have|a question|on|something which|has|me stumped.|I've|been Googling|on|and off|for|a couple|of|days, and|looking|over previous|posts|and examples|etc.|here on|PM,|but haven't|found|anything which|(as|far as|I|can tell)|directly|relates POLICY my @UACS; open my $fIn, '<', \$policy; while (my $pol = <$fIn>) { chomp $pol; push @UACS, (split /\|/, $pol, -1)[2]; } my $line; while (@UACS) { $line .= sprintf '%-22s ', shift @UACS; next if length $line < 60; print "$line\n"; $line = ''; } print $line;
Prints:
end, a something me been and a days, over and here but anything far can relates
|
|---|