in reply to text processing - convert list of vectors to tabular format

This problem is interesting (i.e. fun) because it has two parts, each of which requires some thought: parsing the input data and formatting the output.
Here's my solution:

use strict; my @keys; # just to preserve order my %data; local $_ = do { local $/; <DATA> }; while ( /(v_\w) {\n([^}]*)\n}/g ) { push @keys, $1; $data{$1} = [ split /\n/, $2 ]; } my $row = 0; while (1) { my @v = map { $data{$_}[$row] } @keys; last unless grep defined($_), @v; printf "%-3s", $_ for @v; print "\n"; $row++; }
We're building the house of the future together.