wild guess - is this the kind of thing you are looking for ?
#!/usr/bin/perl # http://perlmonks.org/?node_id=1134550 use warnings; use strict; my (@left, %left, @top, %top, %values); my $all = ''; while(<DATA>) { $all |= $_ for my ($left, $top, $value) = split; $left{$left}++ or push @left, $left; $top{$top}++ or push @top, $top; $values{$left}{$top} = $value; } my $len = length $all; my $fmt = join(' ', map "%${len}s", 0..@top) . "\n"; printf $fmt, '', @top; for my $left (@left) { printf $fmt, $left, map $values{$left}{$_} // '', @top; } __DATA__ aaa bbb 123 aaa ccc 234 aaa ddd 345 bbb ccc 456 bbb ddd 567 ccc ddd 678
prints
bbb ccc ddd aaa 123 234 345 bbb 456 567 ccc 678
In reply to Re: table from repeated strings text
by Anonymous Monk
in thread table from repeated strings text
by anhanijr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |