in reply to Way to "trim" part of a phrase?

I'm not able to understand what you are trying to accomplish with the OP code. I'm especially puzzled by the first "return" statement, which is the fourth expression in the subroutine:
sub cleanup_start_words { my $text = $_[0]; my @split = split //, $text; my @keywords = split //, $_[1]; return $text; # nothing from here down ever gets executed.
Apart from that, if any of the subsequent lines were to be reached and executed, it seems like they're doing a lot of unnecessary work.

Maybe I'm misunderstaning what you're really trying to do, but if the goal is to eliminate the initial portion of a string up to and including the first occurrence of any of these five characters: [!,.:)] -- then a quick/easy way would be:

sub delete_initial_phrase { my ( $phrase ) = @_; if ( $phrase =~ /([!,.:)])/ ) { my $punc = $1; return substr( $phrase, 1 + index( $phrase, $punc )); } else { return $phrase; } }
That will return the original phrase if it contains none of the targeted characters. When any of those characters is present, it will return the string that starts with the very next character (usually a space).

On thinking a bit more about the process, you probably want something slightly different, in case you run into examples like this:

blah blah!) Foo bar, and so on...
Do you want the return value to be ") Foo bar, and so on...", or would you rather remove the initial paren along with the exclamation? If the latter, just change the initial regex:
if ( $phrase =~ /([!,.:)]+)/ ) {
The rest stays the same. Then you also have to change the substr call:
return substr( $phrase, length($punc) + index( $phrase, $punc +));

(updated to fix a couple typos -- and to add the point about modifying the substr call)