Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^3: Align columns in a table

by tybalt89 (Monsignor)
on Aug 29, 2021 at 15:35 UTC ( [id://11136180]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Align columns in a table
in thread Align columns in a table

#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11136164 use warnings; my @data = map [ /\S+(?: \(\S+)?/g ], <DATA>; my @wide; for my $line ( @data ) { $wide[$_] |= '' . $line->[$_] for 0 .. $#$line; } $_ = sprintf "%%-%ds", length for @wide; my $format = join(' ', @wide) . "\n"; #printf $format, @$_ for @data; # previous code my $table = join '', map { sprintf $format, @$_ } @data; # new combine + code print $table;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11136180]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (2)
As of 2024-04-19 19:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found