#!/usr/bin/perl -w # Rotate text input clockwise. # # 2018-01-15 use strict; my @lines = <>; my $height = 0; foreach (@lines) { s/\s*$//s; $height = length($_) if $height < length($_); } for(my $y = 0; $y < $height; $y++) { for(my $x = $#lines; $x >= 0; $x--) { print $y < length($lines[$x]) ? substr($lines[$x], $y, 1) : ' '; } print "\n"; }