in reply to Twiddle

okay, so lets print the thing in a square, and make it readable in several directions (theoretically)
#!/usr/bin/perl -w use strict; print 'What string would you like to twiddle? '; chomp(my $twiddle = <STDIN>); my $string; my $oldString = ""; my $totallen = length($twiddle); my @t = split(//, $twiddle); for (0..$#t) { $string = shift(@t); print $oldString; for(my $i = 0; $i < (2*($totallen - length($oldString))-1); $i++) { print $string; } print (scalar reverse $oldString); print "\n"; # up $oldString .=$string; } while ($oldString) { chop($oldString); $string = substr($oldString, (length($oldString)-1)); print $oldString; # print the first part o' the string (minus the +last character) for(my $i = 0; $i < (2*($totallen - length($oldString))-1); $i++) { print $string; #print each 'last' character up there enough ti +mes to make the square } print (scalar reverse $oldString);# print the last part o' the str +ing (minus the first character) print "\n"; }
hhhhhhhhh
heeeeeeeh
hellllleh
hellllleh
hellolleh
hellllleh
hellllleh
heeeeeeeh
hhhhhhhhh
I know the code is hacky, but it works...
_________________________________________
E-Bitch
Tempora Mutantur Nos et Mutamur in Illis
"The Times are Changed Even as We are Changed in Them"