in reply to PUZZLED
update: After reading chromatic's and wondering why he took the first letter using substr instead choping the last letter I went back and re-read the question... the light came on! I'm rotating the word in the wrong direction. sigh.use strict; my $word = shift @ARGV || "SPACE"; my $count = $word; while( chop $count ) { my $t = chop $word; $word = $t . $word; print $word, "\n"; }
Using chop and what I learned reading chromatic's post, I give you the one liner:
$temp = chop($word) . $temp, print "$temp$word\n" while $word; # $temp and $word should, of course, be initialized.
|
---|