GSoC/GCI Archive
Google Code-in 2011 The Perl Foundation

perl5i: Array->rotate

completed by: Vladimir

mentors: Paul Johnson, Florian Ragwitz, Michael G Schwern

See perl5i: Array->rotate

Thinking of an array of strings as rows and columns, flip the columns and rows. So:

my @rows = ("AAA", "BBB", "123");
my @columns = @rows->rotate; # ("AB1", "AB2", "AB3");

Short rows are filled in with spaces, possible configurable option.

my @rows = ("A", "BBB", "1234");
my @columns = @rows->rotate; # ("AB1", " B2", " B3", " 4");

See http://stackoverflow.com/questions/3206720/perl-hash-of-hash-and-columns/3206871#3206871 for inspiration.