my $s = "abcdefgh"; print "$s\n"; $s .= substr $s, length($s) - 2 * $_, 1 for 1 .. length($s) - 1;# Add the reversed string. substr $s, 0, length($s) / 2, q(); # Remove the original string. print "$s\n";