my $string = join ' ', 1 .. 30; my @parts = $string =~ /((?:\S*\s?){1,11})/g; pop @parts; print ">$_<\n" for @parts;