my $string = 'This is my program'; print do { my @arr = split ' ', $string; join ' ', @arr[-1, 1..$#arr-1, 0],$/ };