#!/usr/bin/perl -w use strict; print 'What string would you like to twiddle? '; chomp(my $twiddle = ); my $string; my @t = split(//, $twiddle); for (0..$#t) { $string .= shift(@t); print $string, "\n"; # up } while ($string) { chop($string); print $string, "\n"; # and down }